4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: SLL on January 11, 2003, 02:13:24 AM

Title: [Mod] Photo Of The Day
Post by: SLL on January 11, 2003, 02:13:24 AM
Quote
Photo Of The Day MOD for 4images - Image Gallery Management System.

Version:      1.2

Author:       Silly Little Lamer <sll@dalnet.ru>

Description:

This Mod shows so called "Photo Of The Day" on the first (and/or any other page) of your gallery. Depending on your settings, the first of the Top Images is selected by rating, number of votes, comments, downloads, hits and its thumbnail is shown as a "Photo Of The Day".

New in v.1.2

•   Random selection mode. (as always, bright idea by V@ano)


Installation Level:    Easy
Installation Time:      10 Minutes

Files To Edit:       4

   /includes/functions.php
   /includes/page_header.php
   /includes/constants.php
   /lang/english/main.php

[EDIT by V@no]
This mod is based on 4images v1.7 some parts of it might not work properly in newer 4images. If mod doesn't work properly for you, try these additional modifications (http://www.4homepages.de/forum/index.php?topic=3529.msg132777#msg132777)
[/EDIT]

demo: http://faces.dalnet.ru/index.php?l=english (http://faces.dalnet.ru/index.php?l=english)
download: http://faces.dalnet.ru/files.php?l=english (http://faces.dalnet.ru/files.php?l=english)
Title: [Mod] Photo Of The Day
Post by: KSA on January 11, 2003, 10:47:26 AM
Thanks SLL
Title: [Mod] Photo Of The Day
Post by: sorestar on January 11, 2003, 05:42:25 PM
Will this MOD work if there is already an interation between phpBB and 4images?

 :D
Title: [Mod] Photo Of The Day
Post by: SLL on January 11, 2003, 08:58:43 PM
Quote from: sorestar
Will this MOD work if there is already an integration between phpBB and 4images?


Sorry, I can't check myself... When I've installed 4images, my phpBB database was full already, so I didn't try to integrate (not recommended by developers).

If the database part, related to 4images is not altered during integration (and I believe it's not), then this MOD should work fine. Anyway, it's simple enough, so it's shouldn't be a big deal for you to try  :wink:
Title: [Mod] Photo Of The Day
Post by: wrestlingwiredotnet on January 12, 2003, 05:04:16 AM
I got this error, does anyone know why?
error:

Parse error: parse error in /home/wwire/public_html/gallery/includes/functions.php on line 128

Fatal error: Call to undefined function: get_php_version() in /home/wwire/public_html/gallery/global.php on line 248


Thanks!!!

~Nate~
Title: [Mod] Photo Of The Day
Post by: V@no on January 12, 2003, 06:42:59 AM
When u edited /includes/functions.php file, u probably forgot put } at the end of script u added.
Quote
function get_potd_image($show_link = 1) {
    global $site_db, $site_template;

switch (POTD_SELECT_MODE) {
   case "by_rating"   : $select_mode = "i.image_rating"; break;
   case "by_votes"      : $select_mode = "i.image_votes"; break;
   case "by_comments"   : $select_mode = "i.image_comments"; break;
   case "by_downloads"   : $select_mode = "i.image_downloads"; break;
}

$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");

    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            ORDER BY $select_mode DESC
            LIMIT 1";

   $potd_image = $site_db->query_firstrow($sql);
   $site_db->free_result();
   $template = 'potd_image';
   show_image($potd_image, "", $show_link);
   $potd_image = $site_template->parse_template($template);
   return $potd_image;
}

;)
Title: Re: nope
Post by: SLL on January 12, 2003, 10:46:49 AM
Quote from: wrestlingwiredotnet
I had that, I didnt forget it... anything else it could be?


It seems, you were posting the whole functions.php here? If so, then have a look at the very end of the file and compare it to the original -  approximately 130 lines are missing. The part of this file, related to the MOD looks OK, I can see no errors...
Title: Re: hm...
Post by: SLL on January 12, 2003, 04:51:44 PM
Quote from: wrestlingwiredotnet
I dont know why, must of been my mistake but it didnt post the entire code, well here it is:


hmm... your functions.php doesn't work on my system also, but i can't find out why  :?

it's slightly different inside, than mine. drop me a privat msg here with your email, and i will send you my functions.php by return, probaly this will help
Title: Hey
Post by: wrestlingwiredotnet on January 12, 2003, 06:09:27 PM
I sent you a Private Message, did u get it???

If not, my email is Nate_Wheeler@MSN.com
Title: [Mod] Photo Of The Day
Post by: V@no on January 12, 2003, 10:55:51 PM
make sure u dont have ANYTHING (spaces, returnsigns...so on) after " ?> " at the end of php files.
Title: Re: what the heck...
Post by: Chris on January 13, 2003, 04:46:51 AM
Quote from: wrestlingwiredotnet
now I get this big long list of errors (with the admin login under it):


Warning: Cannot add header information - headers already sent by (output started at /home/wwire/public_html/gallery/lang/english/main.php:392) in /home/wwire/public_html/gallery/includes/sessions.php on line 79

This is covered in the FAQ forum
Title: AHHHHHHHHHHH
Post by: wrestlingwiredotnet on January 13, 2003, 04:59:41 AM
OK I tried what you and v@no said, I deleted everything AFTER and any spaces return lines or anything before it also, and it didnt work.

Im going out of my mind, why isnt it working?!?!? PLease HELP!
Title: Re: AHHHHHHHHHHH
Post by: SLL on January 13, 2003, 09:50:12 AM
Quote from: wrestlingwiredotnet
Im going out of my mind, why isnt it working?!?!? PLease HELP!


Sorry, Nate, I can't see from here what's going on at your system. I hardly believe this small MOD destroyed you gallery, if you followed installation instructions, of course.

I'd suggest you download the 4images from this site once again, drop the database and make the fresh installation. When you see the gallery running without any error message, the apply this MOD again.

I hope this will help...
Title: Hey
Post by: wrestlingwiredotnet on January 15, 2003, 12:42:28 AM
Just wanted to let you know I got it working, and I was wondering how I would make it on every page? Would I put it on each html template I want it on? Thanks!


~Nate~
Title: [Mod] Photo Of The Day
Post by: V@no on January 15, 2003, 03:31:04 AM
Yes, because its only displays when add {potd_image} in the template.
so, u'll need edit each "MAIN" template like categories.html, home.html, details.html, lightbox.html and so on.
it's easy determ witch template is "main" - it has {header} tag on the top.
Title: [Mod] Photo Of The Day
Post by: widgit1981 on January 20, 2003, 03:37:08 PM
Hi all

Is there any way of displaying the full size image as photo of the day ?

Thanks

Steve
Title: [Mod] Photo Of The Day
Post by: SLL on January 20, 2003, 03:43:44 PM
Quote from: widgit1981
Is there any way of displaying the full size image as photo of the day?

Not a big problem, but I can't even imagine, how this would fit any site design  8O
Title: [Mod] Photo Of The Day
Post by: widgit1981 on January 20, 2003, 03:51:51 PM
Hi SSL.

This would fit my design perfectly and if anyone can do it I would be extremely greatful if they shared the knowledge  :D

Thanks

Steve
Title: [Mod] Photo Of The Day
Post by: SLL on January 22, 2003, 08:34:42 AM
Quote from: widgit1981
This would fit my design perfectly

Should be very interesting to have a look at your site  :roll:

Anyway, to show an image instead ot thumbnail just change {thumbnail} in potd_image.html template to the {image}.

That's it.
Title: [Mod] Photo Of The Day
Post by: widgit1981 on January 22, 2003, 10:18:06 AM
Thanks SSL.

How do you make it linkable as well ?

Thanks

Steve
Title: [Mod] Photo Of The Day
Post by: SLL on January 22, 2003, 10:25:29 AM
Strange questions and wishes again  :lol:
You're linking thumbnail to it's fullsize image, but what are you going to link fullsize image to???
Title: [Mod] Photo Of The Day
Post by: widgit1981 on January 22, 2003, 11:36:48 AM
Hi SSL

Thanks for your great help. Upon clicking the image I want to be directed to the images page. ( description, ratings etc ) Its to hard to explain why I want this but it very needed.

Thanks

Steve
Title: [Mod] Photo Of The Day
Post by: SLL on January 22, 2003, 11:47:09 PM
Now I understand what you mean, but for the moment I have no idea how to help you... thumbnail > image link is hardcoded in the gallery already, but not the link you want. Sorry, dude  :?

If I have any idea/solution, I'll let you know.
Title: Was ist das für ein Fehler ???
Post by: Gabi on January 30, 2003, 11:09:50 AM
Habe alles eingefügt und nun kommt dieser Fehler :


DB Error: Bad SQL Query: SELECT DISTINCT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM 4images_images i, 4images_categories c LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND c.cat_id = i.cat_id ORDER BY RAND()
You have an error in your SQL syntax near 'RAND()' at line 5

Template Error: Couldn't open Template ./templates/4dark/potd_image.html

Kann mir jemand helfen ????

lg
Gabi
Title: [Mod] Photo Of The Day
Post by: SLL on January 30, 2003, 11:27:56 AM
This query has nothing to do with this MOD. Check functions.php against MOD text, I believe you missing something.
Title: Re: Was ist das für ein Fehler ???
Post by: V@no on January 30, 2003, 12:21:34 PM
Quote from: Gabi

You have an error in your SQL syntax near 'RAND()' at line 5

maybe your host doest meet those requrements:
http://4homepages.de/4images/systemvoraussetzungen.php
Title: Re: what the heck...
Post by: robertmf on January 30, 2003, 07:05:24 PM
Quote from: wrestlingwiredotnet
now I get this big long list of errors (with the admin login under it):
Warning: Cannot add header information - headers already sent by (output started at /home/wwire/public_html/gallery/lang/english/main.php:392) in /home/wwire/public_html/gallery/admin/admin_functions.php on line 172

...

 Warning: Cannot add header information - headers already sent by (output started at /home/wwire/public_html/gallery/lang/english/main.php:392) in /home/wwire/public_html/gallery/includes/sessions.php on line 79

Look at the files named and see if you have extra spaces or blank lines after the closing ?> tag.
Title: Manno is das Peinlich
Post by: Gabi on January 30, 2003, 09:43:22 PM
@ all danke

Ich hatte eine Seite falsch benannt, nur 2 Buchstaben vertausch, wieeee doooof aber auch.

lg
Gabi
Title: bild des tages
Post by: remus on February 09, 2003, 03:06:57 PM
klappt alles nur ist das bild am falschen platz, es ist oben links oben dem "registrieerte benutzer" ich möchte es unter dem zufallsbild haben wie muss ich das machen ?

grüsse remus
Title: new choice?
Post by: John_Doe on February 09, 2003, 04:04:50 PM
Hello!
Thank you for this mod!

Is there a way to include the choice "by hits", so the picture with the most hits will appear?

Thanks!
Title: Re: new choice?
Post by: V@no on February 09, 2003, 04:39:04 PM
Quote from: John_Doe
Hello!
Thank you for this mod!

Is there a way to include the choice "by hits", so the picture with the most hits will appear?

Thanks!

yes, its.
in the code u added in /includes/functions.php add this chose:
Code: [Select]
 case "by_hits" : $select_mode = "i.image_hits"; $select_mode2 = ", i.image_name ASC"; break;

and in /includes/constants.php change to this:
Code: [Select]
define('POTD_SELECT_MODE', 'by_hits');


P.S. just a thought.
in this case u probably will have same picture be showed all the time, because visitors will give more "credit" to that picture, u know what I mean? ;)
Title: [Mod] Photo Of The Day
Post by: John_Doe on February 09, 2003, 04:42:14 PM
Thanks for this fast answer  8O
Title: [Mod] Photo Of The Day
Post by: bag53 on February 16, 2003, 09:18:44 AM
How do I keep the "404 File Not Found" icon from appearing when I am logged off?

I have 4images set to not allow guests viewing rights at all. Only registered users can view pictures. When I am at the site as a guest, I get the "404 File Not Found" icon in the spot where the POTD is supposed to be.

I would rather it be like the Random Image, and not show anything to when I am not logged in.
Title: [Mod] Photo Of The Day
Post by: V@no on February 16, 2003, 03:41:24 PM
Quote from: bag53
How do I keep the "404 File Not Found" icon from appearing when I am logged off?

I have 4images set to not allow guests viewing rights at all. Only registered users can view pictures. When I am at the site as a guest, I get the "404 File Not Found" icon in the spot where the POTD is supposed to be.

I would rather it be like the Random Image, and not show anything to when I am not logged in.


In the code that u inserted in /includes/page_header.php at the very top add this:
Code: [Select]
if ($user_info['user_level'] != GUEST) {And at the end of the code add }
So, it would looks like this:
Quote
if ($user_info['user_level'] != GUEST) {
$potd_image = (defined("SHOW_POTD_IMAGE") && SHOW_POTD_IMAGE == 0) ? "" : get_potd_image();
$site_template->register_vars("potd_image", $potd_image);
$site_template->register_vars(array("lang_potd_title" => $lang['potd_title']));
switch (POTD_SELECT_MODE) {
   case "by_rating"   : $site_template->register_vars(array("lang_potd_type" => $lang['potd_type_rating'])); break;
   case "by_votes"      : $site_template->register_vars(array("lang_potd_type" => $lang['potd_type_votes'])); break;
   case "by_comments"   : $site_template->register_vars(array("lang_potd_type" => $lang['potd_type_comments'])); break;
   case "by_downloads"   : $site_template->register_vars(array("lang_potd_type" => $lang['potd_type_downloads'])); break;
   case "by_hits"   : $site_template->register_vars(array("lang_potd_type" => $lang['potd_type_hits'])); break;
}
unset($potd_image);
}
Title: [Mod] Photo Of The Day
Post by: bag53 on February 17, 2003, 06:56:21 AM
Thanks! Great mod!
Title: lightbox on the choices
Post by: Bomba on February 20, 2003, 12:08:53 AM
is it possible to make the photo of the day first choice the number of favorites (lightbox) ?
Title: Re: lightbox on the choices
Post by: SLL on February 20, 2003, 09:01:54 AM
Quote from: Bomba
is it possible to make the photo of the day first choice the number of favorites (lightbox) ?

nope. how do you know, who added particular photo to their favorites?
Title: time limit
Post by: Bomba on February 20, 2003, 02:54:41 PM
hmmm ok i just thought that was the best choice to mark favs
but ok

now i wanna ask something else, i've chosen the option "by_rating" but can i make the photo of the day selected appear only when she's marked as new. so i won't take the risk of featuring always the same pic.
or is there a way that in case of a similar rating between pics the 2nd choice going to "by_votes" ?

thanks
Title: help
Post by: Jasondavis on February 22, 2003, 12:23:36 AM
I dont think what i want is possible but I'll ask, Would there be a way to have it be by top hits of the day? like so it really would be the Pic of the day, otherwise In my galery, it will probably be Pic of the Daya EVERYDAY!
Title: [Mod] Photo Of The Day
Post by: SLL on February 22, 2003, 01:08:59 AM
yeah... why not?
Code: [Select]
switch (POTD_SELECT_MODE) {
case "by_rating" : $select_mode = "i.image_rating"; break;
case "by_votes" : $select_mode = "i.image_votes"; break;
case "by_comments" : $select_mode = "i.image_comments"; break;
case "by_downloads" : $select_mode = "i.image_downloads"; break;
case "by_hits" : $select_mode = "i.image_hits"; break;
}

don't forget to add lang strings...
Title: Re: help
Post by: V@no on February 22, 2003, 01:27:10 AM
Quote from: Jasondavis
I dont think what i want is possible but I'll ask, Would there be a way to have it be by top hits of the day? like so it really would be the Pic of the day, otherwise In my galery, it will probably be Pic of the Daya EVERYDAY!

yes, u are right, it will be EVERYDAY hits.
4images doesnt log time of each hit, it just add to the total of the image hits.
Title: [Mod] Photo Of The Day
Post by: Bomba on February 22, 2003, 04:00:16 AM
and beside hits, is there any way that only shows the pic of the day for one day or as long as she's marked as "new"

that would be great
thanks
Title: [Mod] Photo Of The Day
Post by: Lord Nite on February 22, 2003, 04:22:06 AM
Quote from: SLL
yeah... why not?
Code: [Select]
switch (POTD_SELECT_MODE) {
case "by_rating" : $select_mode = "i.image_rating"; break;
case "by_votes" : $select_mode = "i.image_votes"; break;
case "by_comments" : $select_mode = "i.image_comments"; break;
case "by_downloads" : $select_mode = "i.image_downloads"; break;
case "by_hits" : $select_mode = "i.image_hits"; break;
}

don't forget to add lang strings...


Don't forget to add the
Code: [Select]
case "by_hits"      : $site_template->register_vars(array("lang_potd_type" => $lang['potd_type_hits'])); break; to the includes/page_header.php in order for it to actually show the "selected by hits" under the pic.
Title: [Mod] Photo Of The Day
Post by: V@no on February 22, 2003, 04:31:37 AM
Quote from: Bomba
and beside hits, is there any way that only shows the pic of the day for one day or as long as she's marked as "new"

that would be great
thanks

as I already said, 4images doesnt log time of each hit/rating/vote/ and so on, it just add to the total of the image hit/rating/vote/ and so on.
and if u make it show only new POTD, then after "new" status is "expired" (picture become old) u'll get "404" icon - picture not found.
if u still want it his way, then try replace:
Code: [Select]
           WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_idwith this:
Code: [Select]
           WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id AND i.image_date >= ".(time() - 60 * 60 * 24 * $config['new_cutoff'])."
Title: [Mod] Photo Of The Day
Post by: Lord Nite on February 22, 2003, 04:55:17 AM
I've tried and tried, but can't figure out how to make the POTD appear on the main category and not just the subcategories.

Any help?

I've added the {potd_image} after the {endif random_cat_image} and it will only show up on the categories under the main category.

http://gallery.nitetek.com/categories.php?cat_id=6 <-main category
http://gallery.nitetek.com/categories.php?cat_id=7 <-sub category
Title: [Mod] Photo Of The Day
Post by: V@no on February 22, 2003, 05:09:41 AM
parent and sub categories uses same template, so there is no way u can separate them, without some changes in .php files.
Title: [Mod] Photo Of The Day
Post by: Bomba on February 22, 2003, 05:49:31 AM
i see. and is there a way to clean the top image stats? so i would start counting from 0 every day.

is this possible?
Title: [Mod] Photo Of The Day
Post by: Lord Nite on February 22, 2003, 09:58:28 AM
Quote from: V@no
parent and sub categories uses same template, so there is no way u can separate them, without some changes in .php files.


Figured out that the main category needs at least one image in it before the POTD will show up. :D
Title: [Mod] Photo Of The Day
Post by: Bomba on February 22, 2003, 03:47:30 PM
i was thinking if it's possible to have a direct choice for the POTD, like a url to the thumbnail # or something.

is this possible?
i was thinking on this cause this way i would be able to feature a new pic everyday, even if i have to edit everyday some .php files... i don't mind

thanks
Title: [Mod] Photo Of The Day
Post by: KleinerDrache on March 03, 2003, 02:46:41 AM
Hi,

kann mir jemand sagen was ich ändern muss wenn ich das Pic of the Day auf einer externen seite anzeigen lassen möchte???
Also z.b. auf einer Index Seite die im Hauptverzeichniss liegt!!
Title: [Mod] Photo Of The Day
Post by: V@no on March 03, 2003, 03:30:37 AM
Quote from: Bomba
i was thinking if it's possible to have a direct choice for the POTD, like a url to the thumbnail # or something.

is this possible?
i was thinking on this cause this way i would be able to feature a new pic everyday, even if i have to edit everyday some .php files... i don't mind

thanks

not sure if I understand u correctly, but try this:
in the code u added in /includes/functions.php find:
Code: [Select]
           WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
Replace with:
Code: [Select]
           WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id AND i.image_id = XXXXX
where XXXXX is number of your image ID
Title: [Mod] Photo Of The Day
Post by: Bomba on March 09, 2003, 11:50:17 PM
how can i add additional text to my photo of the day?

i mean, i want to add at the details.htm of the choosen image a text by administration saying why was that picture choosen.
this would be a way to mark the difference bettwen the photos of the day and the regular photos.

thanks
Title: [Mod] Photo Of The Day
Post by: V@no on March 10, 2003, 12:39:15 AM
I'd just edit template  :roll:
Title: [Mod] Photo Of The Day
Post by: Bomba on March 10, 2003, 01:11:04 AM
but how can i edit the details template of that specific image?
if i edit the template it will change all details image id page, right?

 :roll:
Title: [Mod] Photo Of The Day
Post by: SLL on March 10, 2003, 09:20:13 AM
V@no saying that you have to add text to potd_image.html template. As an alternative, you can change the text directly in the /lang/main.php
Code: [Select]
$lang['potd_type_rating'] = "Selected by rating... this is the best pi c at my site ever...bla-bla-bla...";
Title: [Mod] Photo Of The Day
Post by: Bomba on March 10, 2003, 01:45:25 PM
but you're not understanding. that's not what i want. i know how to edit the potd_image_html.
what i want is to edit the details.html of that specific image.

when u click on the thumbnail of the potd it will open the details page, with the description, keywords, user comments, ... and i want to add a text saying why was that picture choosen as POTD.


thanks
Title: [Mod] Photo Of The Day
Post by: V@no on March 10, 2003, 02:16:33 PM
ok, then, u can do this way:
change the code u added into /includes/functions.php to this:
Code: [Select]
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

function get_potd_image($show_link = 1) {
    global $site_template;
   $potd_image = get_potd_id();
   $template = 'potd_image';
   show_image($potd_image, "", $show_link);
   $potd_image = $site_template->parse_template($template);
   return $potd_image;
}
function get_potd_id() {
   global $site_db;
switch (POTD_SELECT_MODE) {
   case "by_rating"   : $select_mode = "i.image_rating"; break;
   case "by_votes"      : $select_mode = "i.image_votes"; break;
   case "by_comments"   : $select_mode = "i.image_comments"; break;
   case "by_downloads"   : $select_mode = "i.image_downloads"; break;
}

$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");

    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            ORDER BY $select_mode DESC
            LIMIT 1";

   $potd_image = $site_db->query_firstrow($sql);
   $site_db->free_result();
   return $potd_image;
}
//--- End Photo Of The Day ----------------------------


in details.php find:
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "msg" => $msg,

replace with:
Code: [Select]
$potd = get_potd_id();
if ($potd['image_id'] == $image_id) {
$potd_msg = "blah blah blah";
}esle{
$potd_msg = "";
}

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "potd_msg" => $potd_msg,
  "msg" => $msg,


after that, in details.html template u can use those tags:
Code: [Select]

{if potd_msg}
---------Your html table, any code---------
{potd_msg}
---------Whatever u want----------
{endif potd_msg}
Title: [Mod] Photo Of The Day
Post by: Bomba on March 10, 2003, 04:25:00 PM
will this potd message stay on that image details for ever, or just as long as she's the selected potd_image?

'cause i'm selecting my gallery photo of the day everyday, and i would like to leave that message for ever in every single photo of the day that i already had chosen (and each one would have the description why was she selected in details.html)

does this code works that way? or just show the message as long as she's selected as potd?

 :roll:  thanks
Title: [Mod] Photo Of The Day
Post by: V@no on March 10, 2003, 08:00:17 PM
Quote from: Bomba
or just show the message as long as she's selected as potd?
yes
Title: [Mod] Photo Of The Day
Post by: Amosnet on March 10, 2003, 09:18:32 PM
Did i miss it?

I need to know how i can show the POTD in an external php page.

Thanks
Title: [Mod] Photo Of The Day
Post by: SLL on March 10, 2003, 10:27:40 PM
Quote from: Amosnet
I need to know how i can show the POTD in an external php page.


you can combine it with "radom image" mod for this
http://www.4homepages.de/forum/viewtopic.php?t=1020
Title: [Mod] Photo Of The Day
Post by: Amosnet on March 10, 2003, 10:29:14 PM
and how can i combine it SLL?
Title: [Mod] Photo Of The Day
Post by: SLL on March 10, 2003, 10:39:57 PM
Well.. just use database queries from POTD in Random Images MOD.... or wait untill V@no post this MOD here  :wink:

Usualy it takes him 15 minutes - from MOD's request to his post here  :lol:
Title: [Mod] Photo Of The Day
Post by: Amosnet on March 10, 2003, 10:43:53 PM
V@no this is a MOD Request!
Title: [Mod] Photo Of The Day
Post by: V@no on March 11, 2003, 01:18:42 AM
Quote from: SLL
you can combine it with "radom image" mod for this
http://www.4homepages.de/forum/viewtopic.php?t=1020

exactly!

Quote from: SLL
or wait untill V@no post this MOD here  :wink:

Usualy it takes him 15 minutes - from MOD's request to his post here  :lol:

o boy! 8O

so, try this code:
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File&#58; potd.php                                           *
 *        Copyright&#58; &#40;C&#41; 2002 Jan Sorgalla                                *
 *            Email&#58; jan@4homepages.de                                    *
 *              Web&#58; http&#58;//www.4homepages.de                             *
 *    Scriptversion&#58; 1.0 for 4images 1.7                                *
 *                                                                        *
 *    Never released without support from&#58; Nicky &#40;http&#58;//www.nicky.net&#41; and SLL &#40;;   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen &#40;http&#58;//www.4homepages.de/4images/lizenz.php&#41; für       *
 *    weitere Informationen.                                              *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    &#40;http&#58;//www.4homepages.de/4images/lizenz_e.php&#41; for further         *
 *    information.                                                        *
 *                                                                        *
 *************************************************************************/

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define&#40;'ROOT_PATH', './4images/'&#41;;
//include&#40;ROOT_PATH.'global.php'&#41;;
include&#40;ROOT_PATH.'config.php'&#41;;
include&#40;ROOT_PATH.'includes/db_mysql.php'&#41;;
include&#40;ROOT_PATH.'includes/constants.php'&#41;;

$site_db = new Db&#40;$db_host, $db_user, $db_password, $db_name&#41;;
function is_remote&#40;$file_name&#41; &#123;
  
return &#40;preg_match&#40;'#^https?\\&#58;\\/\\/[a-z0-9\-&#93;+\.&#40;[a-z0-9\-&#93;+\.&#41;?[a-z&#93;+#i', $file_name&#41;&#41; ? 1 &#58; 0;
&#125;
switch &#40;POTD_SELECT_MODE&#41; &#123;
   
case "by_rating"     &#58; $select_mode = "i.image_rating"; $select_mode2 = ", i.image_votes DESC"; break;
   
case "by_votes"      &#58; $select_mode = "i.image_votes"; $select_mode2 = ", i.image_name ASC"; break;
   
case "by_comments"   &#58; $select_mode = "i.image_comments"; $select_mode2 = ", i.image_name ASC"; break;
   
case "by_downloads"  &#58; $select_mode = "i.image_downloads"; $select_mode2 = ", i.image_name ASC"; break;
   
case "by_hits" &#58; $select_mode = "i.image_hits"; $select_mode2 = ", i.image_name ASC"; break;
   
default  &#58; $select_mode = "i.image_rating"; $select_mode2 = ", i.image_votes DESC"; break;
&#125;
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name
        FROM "
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
        LEFT JOIN "
.USERS_TABLE." u ON &#40;u.user_id = i.user_id&#41;
        WHERE i.image_active=1
    AND i.cat_id = c.cat_id
      AND c.auth_viewcat="
.AUTH_ALL."
     AND c.auth_viewimage="
.AUTH_ALL."
        ORDER BY 
$select_mode DESC $select_mode2
         LIMIT 1"
;
$row $site_db->query_firstrow&#40;$sql&#41;;
$site_db->free_result&#40;&#41;;

$image_id $row['image_id'&#93;;
$cat_id $row['cat_id'&#93;;
$image_name $row['image_name'&#93;;
$image_comments $row['image_comments'&#93;;
$thumb_src = &#40;is_remote&#40;$row['image_thumb_file'&#93;&#41;&#41; ? $row['image_thumb_file'&#93; &#58; ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'&#93;;

echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo 
"<b>$image_name</b><br>\n";
echo 
"Comments&#58; $image_comments<br>\n";
?>


aslo, I'd suggest change from SLL original script switch (POTD_SELECT_MODE) { ... }to this:
Code: [Select]
switch (POTD_SELECT_MODE) {
   case "by_rating"     : $select_mode = "i.image_rating"; $select_mode2 = ", i.image_votes DESC"; break;
   case "by_votes"      : $select_mode = "i.image_votes"; $select_mode2 = ", i.image_name ASC"; break;
   case "by_comments"   : $select_mode = "i.image_comments"; $select_mode2 = ", i.image_name ASC"; break;
   case "by_downloads"  : $select_mode = "i.image_downloads"; $select_mode2 = ", i.image_name ASC"; break;
   case "by_hits" : $select_mode = "i.image_hits"; $select_mode2 = ", i.image_name ASC"; break;
   default : $select_mode = "i.image_rating"; $select_mode2 = ", i.image_votes DESC"; break;
}

and then,
Code: [Select]
       ORDER BY $select_mode DESC
to this:
Code: [Select]
       ORDER BY $select_mode DESC $select_mode2
this will solve little problem, when two images ( aaaa.jpg and bbbb.jpg ) have same rating (4.5), but bbbb.jpg has 10 votes, and aaaa.jpg has only 2 votes. so, with original script it will show aaaa.jpg instead of bbbb.jpg
Title: [Mod] Photo Of The Day
Post by: SLL on March 11, 2003, 08:29:47 AM
Quote from: V@no
aslo, I'd suggest change from SLL original script...


Fixed... Thanks!  :wink:
Title: english vision?
Post by: hiuyu23 on April 15, 2003, 04:46:48 PM
Quote from: SLL
Additional languages for above mode:

Code: [Select]
#
#-----[ OPEN ]----------------------------------------
#

/lang/deutsch/main.php

#
#-----[ ADD ]------------------------------------------
#

//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

$lang['potd_title'] = "Foto des Tages";
$lang['potd_type_rating'] = "nach Bewertung";
$lang['potd_type_votes'] = "nach Stimmen";
$lang['potd_type_comments'] = "nach Kommentar";
$lang['potd_type_downloads'] = "nach Downloads";

#
#-----[ OPEN ]----------------------------------------
#

/lang/russian/main.php

#
#-----[ ADD ]------------------------------------------
#

//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

$lang['potd_title'] = "&#1060;&#1086;&#1090;&#1086;&#1075;&#1088;&#1072;&#1092;&#1080;&#1103; &#1076;&#1085;&#1103;";
$lang['potd_type_rating'] = "&#1042;&#1099;&#1073;&#1088;&#1072;&#1085;&#1086; &#1087;&#1086; &#1088;&#1077;&#1081;&#1090;&#1080;&#1085;&#1075;&#1091;";
$lang['potd_type_votes'] = "&#1042;&#1099;&#1073;&#1088;&#1072;&#1085;&#1086; &#1087;&#1086; &#1075;&#1086;&#1083;&#1086;&#1089;&#1086;&#1074;&#1072;&#1085;&#1080;&#1103;&#1084;";
$lang['potd_type_comments'] = "&#1042;&#1099;&#1073;&#1088;&#1072;&#1085;&#1086; &#1087;&#1086; &#1082;&#1086;&#1084;&#1084;&#1077;&#1085;&#1090;&#1072;&#1088;&#1080;&#1103;&#1084;";
$lang['potd_type_downloads'] = "&#1042;&#1099;&#1073;&#1088;&#1072;&#1085;&#1086; &#1087;&#1086; &#1079;&#1072;&#1075;&#1088;&#1091;&#1079;&#1082;&#1072;&#1084;";



Can you change to english?
Title: how to change the photo in the center?
Post by: hiuyu23 on April 15, 2003, 05:32:58 PM
how to change the photo in the center?

i mean "phopt of the day".

http://utenti.lycos.it/kueou/4images/index.php
Title: [Mod] Photo Of The Day
Post by: lakeside on April 15, 2003, 08:21:18 PM
Another Great Mod

Thanks, this is a great addition to 4images.  It worked without a hitch, other than I needed to fix the potd template so that the POTD name came below the image rather than start next to it.  But this is small and probably was only affected on my site.

Thanks much.
Title: [Mod] Photo Of The Day
Post by: Bomba on April 15, 2003, 11:11:00 PM
how can i add additional field to image details page,
but this field wouldn't show on the user_uploadform. Only admin would be available to edit this field at the admin panel.

This way administrators can write a little description saying why was that pic choosen as "photo of the day", and that text would appear on the details.html of that image, in a way that "photo of the day" become a serious award to the best works and users.

This field when edited would be permanently showed, and not just as long as that pic is selected as "photo of the day". Remembering all "photo of the day" is my idea.


sorry if this is confuse to understand
thanks in advance
Title: Re: english vision?
Post by: SLL on April 16, 2003, 08:19:15 AM
Quote from: hiuyu23
Can you change to english?


no, i can't...  i don't speak english  :cry:
Title: [Mod] Photo Of The Day
Post by: SLL on April 16, 2003, 08:26:10 AM
Quote from: Bomba
Remembering all "photo of the day" is my idea.

well, well... even the name "photo of the day" shows you, that this is dynamic thing... from my point of view it doesn't make any sense to make it fixed. i'd suggest you to make separate category and move winners there manually.
Title: [Mod] Photo Of The Day
Post by: Bomba on April 17, 2003, 03:11:59 PM
but is this additional field hard to make?

i don't want to change pic's category because that would kill the identity that user has chosen to that pic. if user chooses a category to his pic, that should be the category where the pic should stay.

having that little "photo of the day note" on the choosen pics would be discretly and eficient, from my point of view.

thanks
hope that this could be done :)
Title: [Mod] Photo Of The Day
Post by: SLL on April 17, 2003, 11:21:23 PM
Quote from: Bomba
but is this additional field hard to make?

hard enough... this requires db modification, but i'd like to keep this mod simple
Title: POTD reset everyday
Post by: batz on May 08, 2003, 01:30:51 PM
Hi,

This is really a great MOD.

There is any chance of a POTD reset to make it a really POTD?
My settings are by_votes but if an image in 2 days had more votes than an one day photo the first image is the POTD. Can you fix this SSL?

This is very important for me. I have run through the forum but i don't figure how to do this.

Thanks
Paulo
Title: Re: POTD reset everyday
Post by: SLL on May 08, 2003, 03:40:16 PM
Quote from: batz
My settings are by_votes but if an image in 2 days had more votes than an one day photo the first image is the POTD. Can you fix this SSL?

There's nothing to fix. Date of the vote is not stored in the database, so there's no difference between old and new votes, this MOD shows "absolute champion", with the highest number of voices through the whole gallery.
Title: [Mod] Photo Of The Day
Post by: batz on May 09, 2003, 01:42:04 AM
Ok, thanks again.

I have to rename it to "Most Voted Photo" or something like that.  :wink:
Title: So....
Post by: Omnirayf on May 09, 2003, 02:44:15 AM
How can we make a Photo of the Day mod that is essentially a database list of pics that get randomly chosen, displayed for 24 hours, and still display the hit/vote/rank data?

What we are talking about is essentially the Random Image mod, but with a 24 hour display timer on it that also keeps track of when it was last displayed and doesn't get displayed again until it runs through the entire database of pics.

Has this been done already?  Am I just missing something? As it is, the POTD mod will only display the top pic of a given category, and that is not a true POTD. :wink:  :D
Title: Mebbernind!
Post by: Omnirayf on May 09, 2003, 04:43:29 AM
Mebbernind!

I think I have it figured out with the help of a couple of friends....

Code: [Select]

<?php

/**************************************************************************
*                                                                        *
*    4images - A Web Based Image Gallery Management System               *
*    ----------------------------------------------------------------    *
*                                                                        *
*             File&#58; potd.php                                           *
*        Copyright&#58; &#40;C&#41; 2002 Jan Sorgalla                                *
*            Email&#58; jan@4homepages.de                                    *
*              Web&#58; http&#58;//www.4homepages.de                             *
*    Scriptversion&#58; 1.0 for 4images 1.7                                *
*                                                                        *
*    Never released without support from&#58; Nicky &#40;http&#58;//www.nicky.net&#41; and SLL &#40;;   *
*                                                                        *
**************************************************************************
*                                                                        *
*    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
*    bedingungen &#40;http&#58;//www.4homepages.de/4images/lizenz.php&#41; für       *
*    weitere Informationen.                                              *
*    ---------------------------------------------------------------     *
*    This script is NOT freeware! Please read the Copyright Notice       *
*    &#40;http&#58;//www.4homepages.de/4images/lizenz_e.php&#41; for further         *
*    information.                                                        *
*                                                                        *
*************************************************************************/
//Based on the Photo of the Day mod by SLL and V@no
//additional tweaking by Omnirayf 9-5-2003

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define&#40;'ROOT_PATH', './4images/'&#41;;
//include&#40;ROOT_PATH.'global.php'&#41;;
include&#40;ROOT_PATH.'config.php'&#41;;
include&#40;ROOT_PATH.'includes/db_mysql.php'&#41;;
include&#40;ROOT_PATH.'includes/constants.php'&#41;;

$site_db = new Db&#40;$db_host, $db_user, $db_password, $db_name&#41;;
function is_remote&#40;$file_name&#41; &#123;
  
return &#40;preg_match&#40;'#^https?\\&#58;\\/\\/[a-z0-9\-&#93;+\.&#40;[a-z0-9\-&#93;+\.&#41;?[a-z&#93;+#i', $file_name&#41;&#41; ? 1 &#58; 0;
&#125;
    
switch &#40;POTD_SELECT_MODE&#41; &#123;
   
case "by_rating"     &#58; $select_mode = "i.image_rating"; $select_mode2 = ", i.image_votes DESC"; break;
   
case "by_votes"      &#58; $select_mode = "i.image_votes"; $select_mode2 = ", i.image_name ASC"; break;
   
case "by_comments"   &#58; $select_mode = "i.image_comments"; $select_mode2 = ", i.image_name ASC"; break;
   
case "by_downloads"  &#58; $select_mode = "i.image_downloads"; $select_mode2 = ", i.image_name ASC"; break;
   
case "by_hits"                &#58; $select_mode = "i.image_hits"; $select_mode2 = ", i.image_name ASC"; break;
   
default                             &#58; $select_mode = "i.image_rating"; $select_mode2 = ", i.image_votes DESC"; break;
&#125;

$sql "SELECT COUNT&#40;*&#41; as total_images
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_date<"
.mktime&#40;0, 0, 0, date&#40;"m"&#41;, date&#40;"d"&#41;, date&#40;"y"&#41;&#41;."
AND a.image_active=
        
AND a.cat_id b.cat_id 
        
AND b.auth_viewcat=".AUTH_ALL." 
        
AND b.auth_viewimage=".AUTH_ALL."
        ";
$row = $site_db->query_firstrow&#40;$sql&#41;;
$total_images = $row['total_images'&#93;;

mt_srand&#40;mktime&#40;0, 0, 0, date&#40;"
m"&#41;, date&#40;"d"&#41;, date&#40;"y"&#41;&#41;&#41;;
$number = &#40;$total_images > 1&#41; ? mt_rand&#40;0, $total_images - 1&#41; &#58; 0;

$sql = "SELECT a.image_ida.cat_ida.image_namea.image_activea.image_thumb_filea.image_comments 
        FROM 
".IMAGES_TABLE." a".CATEGORIES_TABLE." 
        WHERE a
.image_date<".mktime&#40;0, 0, 0, date&#40;"m"&#41;, date&#40;"d"&#41;, date&#40;"y"&#41;&#41;."
AND a.image_active=
        
AND a.cat_id b.cat_id 
        
AND b.auth_viewcat=".AUTH_ALL." 
        
AND b.auth_viewimage=".AUTH_ALL." 
        
LIMIT $number1";
$row = $site_db->query_firstrow&#40;$sql&#41;;
$image_id = $row['image_id'&#93;;
$cat_id = $row['cat_id'&#93;;
$image_name = $row['image_name'&#93;;
$image_comments = $row['image_comments'&#93;;
$thumb_src = &#40;is_remote&#40;$row['image_thumb_file'&#93;&#41;&#41; ? $row['image_thumb_file'&#93; &#58; ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'&#93;;

echo "
<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><center><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo 
"<b>$image_name</b><br>\n";
echo 
"Comments&#58; $image_comments</center></td></tr></table>\n";
?>


Copy this code to Notepad or Homesite or UltraEdit, rename to potd.php, toss it in your root directory, and then test it by direct url call. You should get any old pic in your 4images database, regardless of stats. Refresh, and the pic should remain the same. After midnight of the date you implement the mod, the pic should change to another random pic for another 24 hours.

This mod has been optimized for people who are using Postnuke or PhpNuke and want a Photo of the Day block. Just make a new php script block and put this into it:
Code: [Select]
include("http://www.your-own-site.com/potd.php");
?>
It works, believe me, especially if you are using Postnuke. Otherwise, if you are having problems with it, add the opening <?php tag.

Let me know if it works for you, as it works for me. This way I can go and slap my friends for their help. :wink:
Title: [Mod] Photo Of The Day
Post by: SLL on May 09, 2003, 08:56:58 AM
Quote from: batz
I have to rename it to "Most Voted Photo" or something like that.  :wink:

It's really the matter of word definitions, nothing else... From my point of view, the "Photo of the Day" is the most rated (voted, dl'd, etc.) picture through the whole gallery for any particular date. I know, I'm not the brightest guy in the world  :wink:  give me the right definition then?

I'm afraid, if you change this MOD the way you want it, it could happens that some day no one picture get votes. What are you supposed to show as a POTD in this case?
Title: Re: Mebbernind!
Post by: SLL on May 09, 2003, 09:02:31 AM
Quote from: Omnirayf
You should get any old pic in your 4images database, regardless of stats. Refresh, and the pic should remain the same. After midnight of the date you implement the mod, the pic should change to another random pic for another 24 hours.

Hmmm.... sorry, I didn't get the idea  :cry:
This script shows random pic within some time frame, and, as I can see, has nothing to do with votes, ratings, etc... So, why do you call it "true POTD"??
Title: Re: Mebbernind!
Post by: V@no on May 09, 2003, 10:01:58 AM
Quote from: SLL
Hmmm.... sorry, I didn't get the idea  :cry:
This script shows random pic within some time frame, and, as I can see, has nothing to do with votes, ratings, etc... So, why do you call it "true POTD"??

the main key is "24 hours" ;)
I'd like have something like that too, it should be then some thing like "POTD - random winner", this something like a lottery for images hehe :lol:
And this could be easily done with some cookies, but then it will we different for each visitor, but...who cares? hehe
Title: Semantics... OY!
Post by: Omnirayf on May 10, 2003, 04:43:21 AM
For my use, Photo of the Day needs to be a randomly chosen pic to be displayed for 24 hours.

If I was going to chose a pic to display as the Top Voted Pic, Top Rated Pic, and the Pic with Most Hits or Downloads, and it not change every 24 hours, then I would keep the mod the way it originally was written.

If I wanted something that restarted every day according to hits, votes, and downloads, then I would make them separate pics, and write if/else functions into the code that would make them visible in that manner, then every 24 hours, they would reset to zero and become active as soon as someone started voting and hitting them. That would drive traffic, but from what I see, it would also encourage cheating because the prog would change pics to suit the one that gains ground. This could happen several times through the day, like a race. I don't need that, but others may be interested in it.

You can see what I have done with it one my site:
www.airbrushonline.com
Title: [Mod] Photo Of The Day
Post by: batz on May 10, 2003, 02:56:39 PM
Quote from: SLL
From my point of view, the "Photo of the Day" is the most rated (voted, dl'd, etc.) picture through the whole gallery for any particular date.


From mine is the most voted photo on a specific day  :D

Quote from: SLL
I know, I'm not the brightest guy in the world  :wink:  give me the right definition then?


You are very bright, believe me.  :lol:

Quote from: SLL
I'm afraid, if you change this MOD the way you want it, it could happens that some day no one picture get votes. What are you supposed to show as a POTD in this case?


Until any photo get voted in a day, the photo of the day remains from the day before.
Title: Re: Semantics... OY!
Post by: batz on May 10, 2003, 03:00:16 PM
Quote from: Omnirayf
For my use, Photo of the Day needs to be a randomly chosen pic to be displayed for 24 hours.


I don't know if i understend your modification MOD.

Your POTD MOD changes every 24 hours, but is based in what stats?
Title: None...
Post by: Omnirayf on May 11, 2003, 04:35:35 AM
It's not based on any stats... The Photo of the Day in my database cold be the worst pic in there, but it would be displayed for 24 hours.

Now if I wanted a pic that was the Top Voted Pic of the database, I would have it that way... which is how the original mod was working for me.

Didn't want that.
Title: Exclude Pics from POTD Mod
Post by: helluvaguy on May 11, 2003, 10:01:50 AM
I was wondering, if it would be possible to exclude pics from one or two specific categories from being displayed in the POTD mod.
Title: From what I understand....
Post by: Omnirayf on May 11, 2003, 11:59:37 AM
...the mod will only bring up pics from categories that are designated public access. Hide your categories by making them private or admin only, and your pics will be hidden from the POTD as well.

If it works differently from that, let us know!
Title: [Mod] Photo Of The Day
Post by: helluvaguy on May 11, 2003, 01:47:04 PM
This is exactly what I didn't wanna do. I want to keep the category public but exclude the pics from appearing in the mod.

I'm not very good at all with SQL, but I thought it could be possible to integrate something that tells the SQL query to get every category, except the ones with 'cat_id xyz'.
Title: Re: Exclude Pics from POTD Mod
Post by: SLL on May 11, 2003, 02:00:58 PM
Quote from: helluvaguy
I was wondering, if it would be possible to exclude pics from one or two specific categories from being displayed in the POTD mod.


Easy enough... just add to POTD sql query limiting statements like this:
Code: [Select]
WHERE ..... AND c.cat_id != 2 ..... AND c.cat_id > 4
Title: [Mod] Photo Of The Day
Post by: helluvaguy on May 11, 2003, 07:57:54 PM
Am I guessing right, that
Code: [Select]
c.cat_id != 2would exclude category 2 and
Code: [Select]
c.cat_id > 4would exclude categories 1, 2 and 3?
Title: [Mod] Photo Of The Day
Post by: SLL on May 12, 2003, 08:46:56 AM
yes, you're right.
Title: Re: [Mod] Photo Of The Day
Post by: artpapa on May 19, 2003, 01:46:04 AM
Quote from: SLL
Code: [Select]
#############################################################################################
## Title: Photo Of The Day for 4images - Image Gallery Management System.
## Version: 1.2
## Author: Silly Little Lamer <sll@dalnet.ru>
## Description: This Mod shows so called "Photo Of The Day" on the first (and/or any
##        other page of your gallery. Dependning on your settings, the first of the
##        Top Images is selected by rating, number of votes, comments, downloads or hits
##        and its thumbnail is shown as a "Photo Of The Day".
##
## Installation Level:    Easy
## Installation Time:    10 Minutes
##
## Files To Edit: 4
##    /includes/functions.php
##    /includes/page_header.php
##    /includes/constants.php
##    /lang/english/main.php
##
#############################################################################################


demo: http://faces.dalnet.ru/index.php?l=english
download: http://www.dalnet.ru/files/4images/


Dear SLL,
Is there any opportunity to display "Photo Of The Day" outside of gallery folder in the static HTML files?

Zaranee blagodaru,

Alexei

www.artpapa.com
www.artpapa.com/gallery
Title: Re: [Mod] Photo Of The Day
Post by: SLL on May 19, 2003, 09:01:13 AM
Quote from: artpapa
Is there any opportunity to display "Photo Of The Day" outside of gallery folder in the static HTML files?

You should combine two MOD's for this: install Random Image MOD (http://www.4homepages.de/forum/viewtopic.php?t=1020) and then change it's original SQL query to the query from this MOD
Title: [Mod] Photo Of The Day
Post by: artpapa on May 20, 2003, 08:08:24 AM
Thank you,
I will probably wait with this improvement until learn a bit more.

Another question: do you think it will be possible instead a picture of the day to do three pictures of the day, like a first, second and third place?
Title: [Mod] Photo Of The Day
Post by: Yegor on May 25, 2003, 08:52:10 AM
Im interested in this too,
SLL, do it for a fellow russian! :D
Title: PODT outside 4images directory
Post by: SLL on May 25, 2003, 09:21:57 AM
Code: [Select]
<?php
define
&#40;'ROOT_PATH', './4images/'&#41;;
define&#40;'SITE_URL', 'http&#58;//www.mygallery.com/'&#41;;

include_once&#40;ROOT_PATH.'config.php'&#41;;
include_once&#40;ROOT_PATH.'includes/db_mysql.php'&#41;;
include_once&#40;ROOT_PATH.'includes/constants.php'&#41;;

define&#40;'PIC_CATEGORIES_TABLE', '4images_categories'&#41;;
define&#40;'PIC_IMAGES_TABLE', '4images_images'&#41;;

$pics_db = new Db&#40;$db_host, $db_user, $db_password, $db_name&#41;;

function is_remote&#40;$file_name&#41; &#123;
  
return &#40;preg_match&#40;'#^https?\\&#58;\\/\\/[a-z0-9\-&#93;+\.&#40;[a-z0-9\-&#93;+\.&#41;?[a-z&#93;+#i', $file_name&#41;&#41; ? 1 &#58; 0;
&#125;

switch &#40;POTD_SELECT_MODE&#41; &#123;
case "by_rating" &#58; $select_mode = "a.image_rating"; break;
case "by_votes" &#58; $select_mode = "a.image_votes"; break;
case "by_comments" &#58; $select_mode = "a.image_comments"; break;
case "by_downloads" &#58; $select_mode = "a.image_downloads"; break;
case "by_hits" &#58; $select_mode = "a.image_hits"; break;
&#125;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits
FROM "
.PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b
WHERE a.image_active=1 AND a.cat_id = b.cat_id AND b.auth_viewcat="
.AUTH_ALL." AND b.auth_viewimage=".AUTH_ALL."
ORDER BY 
$select_mode DESC
LIMIT 1"
;

$row $pics_db->query_firstrow&#40;$sql&#41;;
$image_id $row['image_id'&#93;;
$cat_id $row['cat_id'&#93;;
$image_name $row['image_name'&#93;;
$image_comments $row['image_comments'&#93;;
$thumb_src = &#40;is_remote&#40;$row['image_thumb_file'&#93;&#41;&#41; ? $row['image_thumb_file'&#93; &#58; ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'&#93;;

echo "<a href=\"".SITE_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"></a><br>\n";
echo 
"<b><div class=\"ltgreytext\">$image_name</b></div>\n";
echo 
"Selected by rates<br>\n";

?>


save as potd.php and then include as <?php include("./potd.php"); ?> into your site index.php
Title: [Mod] Photo Of The Day
Post by: balu on May 25, 2003, 10:01:55 AM
is it possible to insert this php i a html site on a other server?

btw. I got this error:
DB Error: Bad SQL Query: SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits FROM 4images_images a, 4images_categories b WHERE a.image_active=1 AND a.cat_id = b.cat_id AND b.auth_viewcat=0 AND b.auth_viewimage=0 ORDER BY DESC LIMIT 1
You have an error in your SQL syntax near 'DESC LIMIT 1' at line 4
Title: [Mod] Photo Of The Day
Post by: SLL on May 25, 2003, 10:11:55 AM
Quote from: balu
is it possible to insert this php i a html site on a other server?

no
Quote from: balu
btw. I got this error:

original POTD mod has to be installed first.
Title: [Mod] Photo Of The Day
Post by: balu on May 25, 2003, 10:19:13 AM
thx for quick response!
I have two pages - one forum that is a php-forum (other domain) and 4images - is this then possible?

What script have I to install first?
Title: [Mod] Photo Of The Day
Post by: balu on May 25, 2003, 11:25:21 AM
now I have installed the potd mod, but there is no pic on screen
may be you have a look into?
http://www.coverengine.de/pod.php

I change this in the .php-file:
Quote
<?php
define('ROOT_PATH', './4images/');
define('SCRIPT_URL', 'http://www.coverengine.de/4images/');

include_once(ROOT_PATH.'config.php');
include_once(ROOT_PATH.'includes/db_mysql.php');
include_once(ROOT_PATH.'includes/constants.php');

define('PIC_CATEGORIES_TABLE', '4images_categories');
define('PIC_IMAGES_TABLE', '4images_images');

$pics_db = new Db($db_host, $db_user, $db_password, $db_name);

function is_remote($file_name) {
  return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}

switch (POTD_SELECT_MODE) {
    case "by_rating"    : $select_mode = "a.image_rating"; break;
    case "by_votes"        : $select_mode = "a.image_votes"; break;
    case "by_comments"    : $select_mode = "a.image_comments"; break;
    case "by_downloads"    : $select_mode = "a.image_downloads"; break;
    case "by_hits"        : $select_mode = "a.image_hits"; break;
}

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits
        FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b
        WHERE a.image_active=1 AND a.cat_id = b.cat_id AND b.auth_viewcat=".AUTH_ALL." AND b.auth_viewimage=".AUTH_ALL."
        ORDER BY $select_mode DESC
        LIMIT 1";

$row = $pics_db->query_firstrow($sql);
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a>\n";

echo "<b><div class=\"ltgreytext\">$image_name</b></div>\n";
echo "Selected by rates\n";

?>
Title: [Mod] Photo Of The Day
Post by: SLL on May 25, 2003, 01:00:34 PM
Hmm.. looks OK... as you can see at your site, no one pic and category given out from SQL query.

As an idea - check permitions in your 4images, if everybody allowed to see pics, not registered/logged-in only. Or remove all references to AUTH_ALL in this code
Title: [Mod] Photo Of The Day
Post by: balu on May 25, 2003, 01:33:51 PM
which line I have to delete?

THX for the quick answer!!!

btw. is it possible to view 4 pictures? mot voted, most download, most view, most rate in 1 row?
Title: [Mod] Photo Of The Day
Post by: SLL on May 25, 2003, 01:59:16 PM
Quote from: balu
which line I have to delete?

Code: [Select]
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits
FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b
WHERE a.image_active=1 AND a.cat_id = b.cat_id
ORDER BY $select_mode DESC
LIMIT 1";

Quote from: balu
btw. is it possible to view 4 pictures? mot voted, most download, most view, most rate in 1 row?

you have to make 4 copies of sql query and set different $select_mode for each one.
Title: [Mod] Photo Of The Day
Post by: balu on May 25, 2003, 02:06:17 PM
The whole???
I deleted it but still no pic!
I am a total newbie in php, how must realize this?

Is it possible in a table with 4 columns?

Very many thx

that is what the .php gives out, maybe there is the mistake?
<a href="http://www.coverengine.de/4images/details.php?image_id="><img src="http://www.coverengine.de/4images/data/thumbnails//" border="0" alt=""></a>
<b><div class="ltgreytext"></b></div>
Selected by rates
Title: [Mod] Photo Of The Day
Post by: SLL on May 25, 2003, 02:16:05 PM
Quote from: balu
The whole??? I deleted it but still no pic!
I am a total newbie in php, how must realize this?


 8O   that's what you have to leave in the code, not delete! just compare it to original...
Title: [Mod] Photo Of The Day
Post by: balu on May 25, 2003, 02:22:30 PM
ok i just fixed it - now a pic is shown! GREAT

i need no link for the pic (details)
now how I must do it for 4 pics in column?
Title: Five in a row...
Post by: SLL on May 25, 2003, 02:32:57 PM
Code: [Select]
<?php
define
&#40;'ROOT_PATH', './4images/'&#41;;
define&#40;'SITE_URL', 'http&#58;//faces.dalnet.ru/'&#41;;

include_once&#40;ROOT_PATH.'config.php'&#41;;
include_once&#40;ROOT_PATH.'includes/db_mysql.php'&#41;;
include_once&#40;ROOT_PATH.'includes/constants.php'&#41;;

define&#40;'PIC_CATEGORIES_TABLE', '4images_categories'&#41;;
define&#40;'PIC_IMAGES_TABLE', '4images_images'&#41;;

$pics_db = new Db&#40;$db_host, $db_user, $db_password, $db_name&#41;;

function is_remote&#40;$file_name&#41; &#123;
  
return &#40;preg_match&#40;'#^https?\\&#58;\\/\\/[a-z0-9\-&#93;+\.&#40;[a-z0-9\-&#93;+\.&#41;?[a-z&#93;+#i', $file_name&#41;&#41; ? 1 &#58; 0;
&#125;

echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits
FROM "
.PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b
WHERE a.image_active=1 AND a.cat_id = b.cat_id
ORDER BY a.image_rating DESC
LIMIT 1"
;

$row $pics_db->query_firstrow&#40;$sql&#41;;
$image_id $row['image_id'&#93;;
$cat_id $row['cat_id'&#93;;
$image_name $row['image_name'&#93;;
$image_comments $row['image_comments'&#93;;
$thumb_src = &#40;is_remote&#40;$row['image_thumb_file'&#93;&#41;&#41; ? $row['image_thumb_file'&#93; &#58; ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'&#93;;

echo "<td><a href=\"".SITE_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"></a><br>\n";
echo 
"<b>$image_name</b><br>\n";
echo 
"Most rated<br></td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits
FROM "
.PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b
WHERE a.image_active=1 AND a.cat_id = b.cat_id
ORDER BY a.image_votes DESC
LIMIT 1"
;

$row $pics_db->query_firstrow&#40;$sql&#41;;
$image_id $row['image_id'&#93;;
$cat_id $row['cat_id'&#93;;
$image_name $row['image_name'&#93;;
$image_comments $row['image_comments'&#93;;
$thumb_src = &#40;is_remote&#40;$row['image_thumb_file'&#93;&#41;&#41; ? $row['image_thumb_file'&#93; &#58; ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'&#93;;

echo "<td><a href=\"".SITE_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"></a><br>\n";
echo 
"<b>$image_name</b><br>\n";
echo 
"Most voted<br></td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits
FROM "
.PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b
WHERE a.image_active=1 AND a.cat_id = b.cat_id
ORDER BY a.image_comments DESC
LIMIT 1"
;

$row $pics_db->query_firstrow&#40;$sql&#41;;
$image_id $row['image_id'&#93;;
$cat_id $row['cat_id'&#93;;
$image_name $row['image_name'&#93;;
$image_comments $row['image_comments'&#93;;
$thumb_src = &#40;is_remote&#40;$row['image_thumb_file'&#93;&#41;&#41; ? $row['image_thumb_file'&#93; &#58; ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'&#93;;

echo "<td><a href=\"".SITE_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"></a><br>\n";
echo 
"<b>$image_name</b><br>\n";
echo 
"Most commented<br></td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits
FROM "
.PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b
WHERE a.image_active=1 AND a.cat_id = b.cat_id
ORDER BY a.image_downloads DESC
LIMIT 1"
;

$row $pics_db->query_firstrow&#40;$sql&#41;;
$image_id $row['image_id'&#93;;
$cat_id $row['cat_id'&#93;;
$image_name $row['image_name'&#93;;
$image_comments $row['image_comments'&#93;;
$thumb_src = &#40;is_remote&#40;$row['image_thumb_file'&#93;&#41;&#41; ? $row['image_thumb_file'&#93; &#58; ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'&#93;;

echo "<td><a href=\"".SITE_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"></a><br>\n";
echo 
"<b>$image_name</b><br>\n";
echo 
"Most downloaded<br></td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits
FROM "
.PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b
WHERE a.image_active=1 AND a.cat_id = b.cat_id
ORDER BY a.image_hits DESC
LIMIT 1"
;

$row $pics_db->query_firstrow&#40;$sql&#41;;
$image_id $row['image_id'&#93;;
$cat_id $row['cat_id'&#93;;
$image_name $row['image_name'&#93;;
$image_comments $row['image_comments'&#93;;
$thumb_src = &#40;is_remote&#40;$row['image_thumb_file'&#93;&#41;&#41; ? $row['image_thumb_file'&#93; &#58; ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'&#93;;

echo "<td><a href=\"".SITE_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"></a><br>\n";
echo 
"<b>$image_name</b><br>\n";
echo 
"Most viewed<br></td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

echo "</tr></table>\n";

?>
Title: [Mod] Photo Of The Day
Post by: balu on May 25, 2003, 02:40:31 PM
FANTASTIC!!!!

One last question:

how to center this table and columns
Title: [Mod] Photo Of The Day
Post by: V@no on May 25, 2003, 05:12:34 PM
Quote from: balu
how to center this table and columns

add align=\"center\" in each <td> tag
Title: [Mod] Photo Of The Day
Post by: balu on May 25, 2003, 05:30:11 PM
many many thx - the smallest problem are the greatest  :lol:

btw. is it possible to add "the uploader" under the pics?
Title: [Mod] Photo Of The Day
Post by: V@no on May 25, 2003, 06:04:58 PM
Quote from: balu
btw. is it possible to add "the uploader" under the pics?

yes, at the end of each $sql = "SELECT ..... line add:
, a.user_id, u.user_name, u.user_id
so for example for the rating part it would be like this:
Quote
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits, a.user_id, u.user_name, u.user_id

now, at the end of next line add: , ".USERS_TABLE." u
so it would looks like:
Quote
FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b, ".USERS_TABLE." u

then, at the end of next line add AND u.user_id = a.user_id
it should looks like this:
Quote
WHERE a.image_active=1 AND a.cat_id = b.cat_id AND u.user_id = a.user_id

then after $image_id = $row['image_id']; add
$user_name = $row['user_name']
then insert $user_name whereever u want ;)


@SLL:
since u have
Quote
include_once(ROOT_PATH.'includes/constants.php');

next two line are not necessery, u could use CATEGORIES_TABLE and USERS_TABLE ;)
Title: [Mod] Photo Of The Day
Post by: Yegor on May 25, 2003, 06:49:59 PM
Im gonna set this up myself today.

Wow, your amazing skills put me to shame. *bows*

Thanksa lot guys!
Title: [Mod] Photo Of The Day
Post by: balu on May 25, 2003, 06:58:20 PM
:o  GREAT
some colors possible and fontstyles and then it will be perfect!!!

@ v@no or sll

I have a funny mystic in my memberlist:

all you users ca see it correct - I not - why? I delete the cache.... I always see 0 members at 0 pages - Funny isn´it?
Title: [Mod] Photo Of The Day
Post by: balu on May 25, 2003, 07:21:25 PM
Absolut GREAT
here the full mod - thx to sll and v@no!!!
Quote
<?php
define('ROOT_PATH', './4images/');
define('SITE_URL', 'http://www.yourdomain.de/');

include_once(ROOT_PATH.'config.php');
include_once(ROOT_PATH.'includes/db_mysql.php');
include_once(ROOT_PATH.'includes/constants.php');

define('PIC_CATEGORIES_TABLE', '4images_categories');
define('PIC_IMAGES_TABLE', '4images_images');

$pics_db = new Db($db_host, $db_user, $db_password, $db_name);

function is_remote($file_name) {
  return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}

echo "<table width=\"100%\" border=\"0\" cellspacing=\"10\" cellpadding=\"1\"><tr>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits, a.user_id, u.user_name, u.user_id
        FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b, ".USERS_TABLE." u
        WHERE a.image_active=1 AND a.cat_id = b.cat_id AND u.user_id = a.user_id
        ORDER BY a.image_rating DESC
        LIMIT 1";

$row = $pics_db->query_firstrow($sql);
$image_id = $row['image_id'];
$user_name = $row['user_name'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<td align=\"center\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"><br>\n";
echo "<b>$image_name</b><br>\n";
echo "uploaded by <b>$user_name</b><br>\n";
echo "Top Rates</td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits, a.user_id, u.user_name, u.user_id
        FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b, ".USERS_TABLE." u
        WHERE a.image_active=1 AND a.cat_id = b.cat_id AND u.user_id = a.user_id
        ORDER BY a.image_votes DESC
        LIMIT 1";

$row = $pics_db->query_firstrow($sql);
$image_id = $row['image_id'];
$user_name = $row['user_name'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<td align=\"center\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"><br>\n";
echo "<b>$image_name</b><br>\n";
echo "uploaded by <b>$user_name</b><br>\n";
echo "Top Votes</td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits, a.user_id, u.user_name, u.user_id
        FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b, ".USERS_TABLE." u
        WHERE a.image_active=1 AND a.cat_id = b.cat_id AND u.user_id = a.user_id
        ORDER BY a.image_comments DESC
        LIMIT 1";

$row = $pics_db->query_firstrow($sql);
$image_id = $row['image_id'];
$user_name = $row['user_name'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<td align=\"center\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"><br>\n";
echo "<b>$image_name</b><br>\n";
echo "uploaded by <b>$user_name</b><br>\n";
echo "Top Kommentare</td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits, a.user_id, u.user_name, u.user_id
        FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b, ".USERS_TABLE." u
        WHERE a.image_active=1 AND a.cat_id = b.cat_id AND u.user_id = a.user_id
        ORDER BY a.image_downloads DESC
        LIMIT 1";

$row = $pics_db->query_firstrow($sql);
$image_id = $row['image_id'];
$user_name = $row['user_name'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<td align=\"center\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"><br>\n";
echo "<b>$image_name</b><br>\n";
echo "uploaded by <b>$user_name</b><br>\n";
echo "Top Downloads</td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits, a.user_id, u.user_name, u.user_id
        FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b, ".USERS_TABLE." u
        WHERE a.image_active=1 AND a.cat_id = b.cat_id AND u.user_id = a.user_id
        ORDER BY a.image_hits DESC
        LIMIT 1";

$row = $pics_db->query_firstrow($sql);
$image_id = $row['image_id'];
$user_name = $row['user_name'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<td align=\"center\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"><br>\n";
echo "<b>$image_name</b><br>\n";
echo "uploaded by <b>$user_name</b><br>\n";
echo "Top Hits</td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

echo "</tr></table>\n";

?>
Title: [Mod] Photo Of The Day
Post by: SLL on May 25, 2003, 10:03:11 PM
Quote from: V@no
@SLL:
since u have
Quote
include_once(ROOT_PATH.'includes/constants.php');

next two line are not necessery, u could use CATEGORIES_TABLE and USERS_TABLE ;)

nope  :wink:   long time ago i've got a problem due to this, and almost lost my hairs trying to find it...  i was running two includes in my index.php, for phpbb and 4images, and they're both using USERS_TABLE variable, so one of them didn't work before i've defined different names directly in those included files.
Title: [Mod] Photo Of The Day
Post by: V@no on May 25, 2003, 10:32:16 PM
Quote from: SLL
nope  :wink:   long time ago i've got a problem due to this, and almost lost my hairs trying to find it...  i was running two includes in my index.php, for phpbb and 4images, and they're both using USERS_TABLE variable, so one of them didn't work before i've defined different names directly in those included files.
I still dont get it...
if u include SPECIFIC constants.php from 4IMAGES dir, then what does it have with phpbb? it would be a mess, if u include global.php and then constants.php or something...
Title: v.1.2
Post by: SLL on May 27, 2003, 10:22:34 PM
New version posted. Now you can set random selection mode (by votes, hits, comments, etc.)

download: http://faces.dalnet.ru/files.php?l=english
Title: Re: v.1.2
Post by: artpapa on May 28, 2003, 12:17:55 AM
Quote from: SLL
New version posted. Now you can set random selection mode (by votes, hits, comments, etc.)


Dear  SLL.

Where you posted ?
Title: Re: v.1.2
Post by: V@no on May 28, 2003, 12:44:59 AM
Quote from: artpapa
Where you posted ?

First post in this thread. Check the history log.
Title: [Mod] Photo Of The Day
Post by: Extirpator on June 06, 2003, 01:43:27 PM
sorry... i ran thru the whole thread & is still puzzled with discussion...
i have got the mod working already....
but how do i exclude images of 1 or more categories from appearing in the potd?
Title: [Mod] Photo Of The Day
Post by: FreDyz on June 23, 2003, 08:21:07 PM
I've seen that V@no has modified the MOD in his website to show the Photo of the hour. I need for my website the photo of the week, What I have to change?

Thanks a lot
Title: Re: [Mod] Photo Of The Day
Post by: Vincent on April 11, 2005, 08:11:52 AM
Hello
i haven't installed yet - my question
how the mod works - i mean thouse the mod reset the counter every night?
because i found out that on my side the picture of the day is also the most clicked because it is already on the top!

sincerly
vincent
Title: Re: [Mod] Photo Of The Day
Post by: artpics on April 11, 2005, 08:37:50 AM
it can be configured to choose from most hits, votes, downloads,ranking, comments.

Title: Re: [Mod] Photo Of The Day
Post by: Vincent on April 11, 2005, 09:33:32 AM
most hits is alright /
i have already on installed - the problem is after one week the hits of the picture foto of the day got 100 times more hit then the second one!
it means the person how go to my page will fast click on the already foto of the day! so this picture will rapidly encrase the hits and there will never been a chance to another picture!
until today in the night i set the hit counter to zero - but this is not making me happy

vincent
Title: Re: [Mod] Photo Of The Day
Post by: Vincent on April 24, 2005, 08:23:03 PM
 :?:
 :?
 8) vincent
Title: Re: [Mod] Photo Of The Day
Post by: vietdragon on June 06, 2005, 03:35:41 AM
I have this erro .

DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM 4images_images i, 4images_categories c LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND c.cat_id = i.cat_id ORDER BY DESC LIMIT 1
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC LIMIT 1' at line 5

Title: Re: [Mod] Photo Of The Day
Post by: CeJay on August 03, 2005, 09:43:12 PM
I get this error
Quote
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM 4images_images i, 4images_categories c LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND c.cat_id = i.cat_id ORDER BY DESC LIMIT 1
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC LIMIT 1' at line 5

The person that has been helping me with getting this added (as I don't know PHP, so got help before trying to tackle something like this) told me to say "explain that the sql statement it is talkin about is added w/this mod into the functions.php file" and "what do we do to get it to run properly?"

Any ideas on how to go about getting this to work?
Title: Re: [Mod] Photo Of The Day
Post by: CeJay on August 05, 2005, 06:17:02 AM
Took a while, but we got it working.
It wasn't the functions.php file that was giving the errors, it was the constants.php that was.

So if anyone else has this issue (same error) take a look at that file first.
In the directions we downloaded it shows you can make your POTD either by 'by_votes', 'by_rating', 'by_comments', 'by_downloads', 'by_hits' or 'random' in the constants.php.
What we had to do was remove the "by_" section and just place in what you want it to show for.

Once we did that the error disappeared and all is working great!

Here is a copy of the code that we used to show by votes:
Code: [Select]
// Set "SHOW_POTD_IMAGE" to 1 if you would like to show Photo Of The Day.
// The choices to select Photo Of The Day are: 'by_votes', 'by_rating', 'by_comments', 'by_downloads', 'by_hits' or 'random'
define('SHOW_POTD_IMAGE', 1);
define('POTD_SELECT_MODE', 'votes');
Title: Re: [Mod] Photo Of The Day
Post by: Michael on August 15, 2005, 09:39:10 PM
Wo und was muß man etwas ändern wenn mehrere potd Bilder angezeigt werden sollen ?
Title: Re: [Mod] Photo Of The Day
Post by: toocoolbd on August 21, 2005, 09:11:22 PM
My problem is no text appears over the photo of the day picture thumbnail. Nothing. I did edit /lang/english/main.php but i'm not sure what went wrong. is there any specific place to add the new lines? or can anyone give me the main.php file?
Title: Re: [Mod] Photo Of The Day
Post by: Loda on August 23, 2005, 02:24:52 PM
if you want to show the potd for the current month:

open /includes/functions.php
find in the potd mode:
Code: [Select]
        WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
 


replace it with:
 
Code: [Select]
WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id AND i.image_date >= ".(mktime(0, 0, 0, date("m")  , 1, date("Y")))."
         
Title: Re: [Mod] Photo Of The Day
Post by: zit501 on August 28, 2005, 09:20:57 AM
Hi,
I have a problem with POTD.
It seems to work, but when it is on in always displays the third image from the new images box? Go check it out: www.mont.za.net (http://www.mont.za.net)

It's weird, and I don't know too much about php, so if you could give me a list of possible problems that I could check, that would be great!

Thanks alot.
Title: Re: [Mod] Photo Of The Day
Post by: Itapeva on August 28, 2005, 04:17:51 PM
My problem is no text appears over the photo of the day picture thumbnail. Nothing. I did edit /lang/english/main.php but i'm not sure what went wrong. is there any specific place to add the new lines? or can anyone give me the main.php file?

I GOT this problem Too :(
Title: Re: [Mod] Photo Of The Day
Post by: Itapeva on August 30, 2005, 01:25:45 PM
My problem is no text appears over the photo of the day picture thumbnail. Nothing. I did edit /lang/english/main.php but i'm not sure what went wrong. is there any specific place to add the new lines? or can anyone give me the main.php file?

I GOT this problem Too :(

Someone can help-me?

I install the Photo Of The Day.. but... no text appears over the photo of the day picture thumbnail too :(
Title: Re: [Mod] Photo Of The Day
Post by: CeJay on August 31, 2005, 10:51:57 AM
My problem is no text appears over the photo of the day picture thumbnail. Nothing. I did edit /lang/english/main.php but i'm not sure what went wrong. is there any specific place to add the new lines? or can anyone give me the main.php file?

I GOT this problem Too :(

Someone can help-me?

I install the Photo Of The Day.. but... no text appears over the photo of the day picture thumbnail too :(


Not sure what text you are looking to have.
If you only want it to say Photo of the Day then you will need to edit your potd_image.html file and add the text yourself.

Here is what I did:
Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr><td class="head2" height="20" align="center"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />Photo
   of The Day</td></tr>
  <tr><td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td></tr>
  <tr><td align="center" class="row1"><br />{thumbnail}<br /><b>{image_name}</b><br /></td></tr>
  <tr><td align="center" class="row1">{lang_potd_type}<br />Image by Hits<br /></td></tr>
  <tr><td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td></tr>
</table>

As you can see I also edited the botton to say "Image by Hits". You can also change this to say what ever you want.
Title: Re: [Mod] Photo Of The Day
Post by: CeJay on August 31, 2005, 10:59:18 AM
I am having an issue adding the potd to an external html file.
I would greatly appreciate any help on getting this to work in the next few days.

I see that an earlier post it says something about the random image mod. However I do not know if this needs to be used as the randmon image is already included with the gallery.
I have potd working on the directory it was installed, but just can not get it to call the potd to an external page in the root directory.

I have added the potd.php to the root directory and made changes as I saw them in the forum and still get an error and have no idea on why.
I can only see an error if I use it in a .php page the I created just to see the error.
I know nothing about php but have someone helping me with it. This is the error I get:
Quote
DB Error: Bad SQL Query: SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits FROM gallery_images a, gallery_categories b WHERE a.image_active=1 AND a.cat_id = b.cat_id AND b.auth_viewcat=0 AND b.auth_viewimage=0 ORDER BY DESC LIMIT 1
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC LIMIT 1' at line 4
 
Selected by rates

Now I originally set it up to post the potd by "hits" so I am not sure if this is why I am getting the error.

SLL if you are willing to help, maybe even get this working for me I can pay you for it. You just have to send me a PM on how much and how to pay you. I am limited on how much I can pay, but still let me know and I will return the PM as soon as I can.
Title: Re: [Mod] Photo Of The Day
Post by: Itapeva on August 31, 2005, 01:59:08 PM
My problem is no text appears over the photo of the day picture thumbnail. Nothing. I did edit /lang/english/main.php but i'm not sure what went wrong. is there any specific place to add the new lines? or can anyone give me the main.php file?

I GOT this problem Too :(

Someone can help-me?

I install the Photo Of The Day.. but... no text appears over the photo of the day picture thumbnail too :(


Not sure what text you are looking to have.
If you only want it to say Photo of the Day then you will need to edit your potd_image.html file and add the text yourself.

Here is what I did:
Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr><td class="head2" height="20" align="center"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />Photo
   of The Day</td></tr>
  <tr><td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td></tr>
  <tr><td align="center" class="row1"><br />{thumbnail}<br /><b>{image_name}</b><br /></td></tr>
  <tr><td align="center" class="row1">{lang_potd_type}<br />Image by Hits<br /></td></tr>
  <tr><td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td></tr>
</table>

As you can see I also edited the botton to say "Image by Hits". You can also change this to say what ever you want.

But.. I turn "random" images :(

SO.. if I called it for:
  <tr><td align="center" class="row1">{lang_potd_type}<br />Image by Hits<br /></td></tr>

Get one error :(

aff.. my gallery dont show the names :(
Title: Re: [Mod] Photo Of The Day
Post by: CeJay on August 31, 2005, 02:17:15 PM
Quote

But.. I turn "random" images :(

SO.. if I called it for:
  <tr><td align="center" class="row1">{lang_potd_type}<br />Image by Hits<br /></td></tr>

Get one error :(

aff.. my gallery dont show the names :(

Not sure what you mean by "turn random images".?
Are you sure all the code is correct if it is not displaying the name?
Even when I first added this I would get the name, but no image until I fixed the code.
Title: Re: [Mod] Photo Of The Day
Post by: SLL on September 03, 2005, 10:29:42 AM
I am having an issue adding the potd to an external html file.
I would greatly appreciate any help on getting this to work in the next few days.
long time ago i've posted a small script to show random/latest picture at the external page, even on different server. unfortunatelly, now i can't find it nether here, nor on my computer. probably it was lost during phpbb hack. maybe other users here could help you to find it, if so you can slightly modify it to show picture of the day.
Title: Re: [Mod] Photo Of The Day
Post by: Itapeva on September 03, 2005, 02:39:31 PM
My problem is no text appears over the photo of the day picture thumbnail. Nothing. I did edit /lang/english/main.php but i'm not sure what went wrong. is there any specific place to add the new lines? or can anyone give me the main.php file?

I GOT this problem Too :(

Someone can help-me?

I install the Photo Of The Day.. but... no text appears over the photo of the day picture thumbnail too :(


Not sure what text you are looking to have.
If you only want it to say Photo of the Day then you will need to edit your potd_image.html file and add the text yourself.

Here is what I did:
Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr><td class="head2" height="20" align="center"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />Photo
   of The Day</td></tr>
  <tr><td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td></tr>
  <tr><td align="center" class="row1"><br />{thumbnail}<br /><b>{image_name}</b><br /></td></tr>
  <tr><td align="center" class="row1">{lang_potd_type}<br />Image by Hits<br /></td></tr>
  <tr><td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td></tr>
</table>

As you can see I also edited the botton to say "Image by Hits". You can also change this to say what ever you want.

Ok..  I set
Code: [Select]
...="4" />Photo of The Day</td...
But I cant set
Code: [Select]
lang_potd_type}<br />Image by Hits<br /></
because i set in constance.php
Code: [Select]
POTD_SELECT_MODE', 'random');
So.. if I set
Code: [Select]
lang_potd_type}<br />Image by Hits<br /></ in the home.html
All time show Images by Hits...

:( I tunr randon..
so.. it neeed show sometimes
$lang['potd_type_votes'] ...
sometimes
$lang['potd_type_hits'] ...
sometimes
$lang['potd_type_comments'] ...
sometimes
$lang['potd_type_downloads']...

aff... my {lang_potd_type} cannot show it :(
Title: Re: [Mod] Photo Of The Day
Post by: CeJay on September 07, 2005, 12:22:40 AM
I am having an issue adding the potd to an external html file.
I would greatly appreciate any help on getting this to work in the next few days.
long time ago i've posted a small script to show random/latest picture at the external page, even on different server. unfortunatelly, now i can't find it nether here, nor on my computer. probably it was lost during phpbb hack. maybe other users here could help you to find it, if so you can slightly modify it to show picture of the day.

I will keep looking, maybe with any luck I will find it   :o
Title: Re: [Mod] Photo Of The Day
Post by: CeJay on September 07, 2005, 12:36:44 AM
Itapeva,

The "Image by Hits" is only basic HTML in the potd_image.html, so it can not call what the random image is.
If you want that part to say nothing all you need to do is remove the cell or just the wording in that table.
There is no way that i know of to change the text daily unless you actually edit the html yourself daily.

Find:
Code: [Select]
<tr><td align="center" class="row1">{lang_potd_type}<br />Image by Hits<br /></td></tr>
Replace with:
Code: [Select]
<tr><td align="center" class="row1">{lang_potd_type}<br /><br /></td></tr>
This is so it will not say anything. If you want it to say something then you put whatever text you want in between the br tags.
Title: Re: [Mod] Photo Of The Day
Post by: Egly on September 09, 2005, 11:40:00 PM
Hi folks!

I installed this mod and got this error:

Code: [Select]
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description,
 i.image_keywords, i.image_date,
 i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments,
i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM egly_images i,
 egly_categories c
LEFT JOIN egly_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND c.cat_id =
i.cat_id ORDER BY DESC LIMIT 1
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax
 to use near 'DESC LIMIT 1' at line 5

Would somebody plz help me?

SQL Version is 4.0...
Title: Re: [Mod] Photo Of The Day
Post by: TIMT on October 15, 2005, 09:37:46 AM
when I chose the Random selection mode, then every day an other pic is shown. No matter how many hits, votes, a.s.o. the pic has got. Is that correct?
Title: Re: [Mod] Photo Of The Day
Post by: BartAfterDark on October 26, 2005, 01:26:38 PM
I also get a Bad SQL Query
Code: [Select]
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.username FROM 4images_images i, 4images_categories c LEFT JOIN phpbb_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND c.cat_id = i.cat_id ORDER BY DESC LIMIT 1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC LIMIT 1' at line 5
Title: Re: [Mod] Photo Of The Day
Post by: Nasser on October 27, 2005, 11:28:16 AM
thanks for this MOD I'm using it
Title: Re: [Mod] Photo Of The Day
Post by: RuthE on November 03, 2005, 09:03:16 PM
I just installed this mod and it's working great, except none of the language is showing up. My title is missing and the text that says how the picture was chosen. I must have done something wrong, but I've redone the language file several times now.

http://www.discoverkate.com/gallery/
Title: Re: [Mod] Photo Of The Day
Post by: RuthE on November 08, 2005, 09:21:24 PM
Well, I've checked and re-checked this code, it looks like the text ought to be there, but it's just not coming up. Anything to go on as to why text wouldn't be getting pulled up by the lang tag?
Title: Re: [Mod] Photo Of The Day
Post by: cinestar on December 17, 2005, 07:53:06 PM
I have been using the mod now for 4 days, I though it was working fine the first day, but its been four days now and the image hasnt changed.

What could be wrong?
Title: Re: [Mod] Photo Of The Day
Post by: tradenet on December 19, 2005, 05:51:30 PM
Yeah, I have the same porblem...
For some reason {lang_potd_title} & {lang_potd_type}
Don't show up.

 :|

Well, I've checked and re-checked this code, it looks like the text ought to be there, but it's just not coming up. Anything to go on as to why text wouldn't be getting pulled up by the lang tag?
Title: Re: [Mod] Photo Of The Day
Post by: RuthE on January 07, 2006, 10:12:03 PM
I feel like I've done something obviously wrong, I've double-checked everying, I'm thinking maybe it's the potd_image.html that I messed up, so here it is. I still don't have any text showing up unless I write it in to this file manually.

Code: [Select]
<strong>{lang_potd_title}</strong><br /><br />
<div align="center"><span class="thumb">{thumbnail}</span><br />
{lang_potd_type}</div>
Title: Re: [Mod] Photo Of The Day
Post by: Fastian on January 15, 2006, 10:57:18 PM
Yeah, I have the same porblem...
For some reason {lang_potd_title} & {lang_potd_type}
Don't show up.

I read the whole Post and seems like i am not the only one having trouble with this mod.
Two problems so far.
1) I cant seem to use {lang_potd_title} & {lang_potd_type} in potd_image.html. They just dont show up.
 
2) I tried to change selection method of "random' to 'by_hits' and i got a long DB syntex error message.

What i think is, something needs to be change to work it with V 1.7.1

May be this part in " /includes/page_header.php "
Code: [Select]
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

$potd_image = (defined("SHOW_POTD_IMAGE") && SHOW_POTD_IMAGE == 0) ? "" : get_potd_image();
$site_template->register_vars("potd_image", $potd_image);
$site_template->register_vars(array("lang_potd_title" => $lang['potd_title']));
$site_template->register_vars(array("lang_potd_type" => $lang['potd_type_'.ereg_replace ("i.image_", "", $select_mode)]));
unset($potd_image);
//--- End Photo Of The Day ----------------------------

Title: Re: [Mod] Photo Of The Day
Post by: V@no on January 15, 2006, 11:27:08 PM
1) looks like you forgot add the code in your language files (lang/<your langauge>/main.php)
2) there is a misstake in the instructions.
Quote
// The choices to select Photo Of The Day are: 'by_votes', 'by_rating', 'by_comments', 'by_downloads', 'by_hits' or 'random'
should actualy looks like this:
Quote
// The choices to select Photo Of The Day are: 'votes', 'rating', 'comments', 'downloads', 'hits' or 'random'
Title: Re: [Mod] Photo Of The Day
Post by: Fastian on January 16, 2006, 02:56:18 AM
V@no

I double checked every thing. I am not missing anything..

By ur little correction, I am now shoing POTD using "hits" and manually adding Text in potd_image.html.

{lang_potd_title} is not important but to use "random" {lang_potd_type} must be working. And i cant use it with what ever i tried. 
Title: Re: [Mod] Photo Of The Day
Post by: Wistom on January 23, 2006, 11:44:57 PM
V@no

I double checked every thing. I am not missing anything..

By ur little correction, I am now shoing POTD using "hits" and manually adding Text in potd_image.html.

{lang_potd_title} is not important but to use "random" {lang_potd_type} must be working. And i cant use it with what ever i tried. 


hi,
try this :

add directly the code in the page (ex. home.html of your template dir.) where you want it to be displayed (after random image for ex.):
Code: [Select]
<table width="150" border="0" cellspacing="0" cellpadding="0">
  <tr><td class="head2" height="20" align="left"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_potd_title}</td></tr>
  <tr><td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td></tr>
  <tr><td align="center" class="row1">{potd_image}</td></tr>
  <tr><td align="center" class="row1">{lang_potd_type}<br /><br /></td></tr>
  <tr><td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td></tr>
</table>

and then modifie the potd_image.html in your template dir.
it shoud look like
Code: [Select]
<br />{thumbnail}<br /><b>{image_name}</b><br />

tell me if that works for you :)

Title: Re: [Mod] Photo Of The Day
Post by: roflnator on March 25, 2006, 01:03:41 PM
is it possible to modificate the mod in a way that i can
choose a image id day by day by myself?
likely a by_self variable thats not searching for an image
this variable should by the image
like
byself: 1004;
if 1004 is the image id

if dont understand php as well as its neccesarry. so plz help me
me user argue about a never changing "pic of the day"
so i want to select the image by myself and i dont wannt do
paste all links and thumb links in the potd_image.html

THANKS
Title: Re: [Mod] Photo Of The Day
Post by: fish4carp on April 12, 2006, 09:49:58 PM
Jusy installed this mod but it dosen't say "Photo of the Day" above the photo, please can some one help.
Title: Re: [Mod] Photo Of The Day
Post by: Yast on April 27, 2006, 09:44:53 PM
Hello,

First sorry for my bad english.
I have the same problem with text output, but I have built me a workaround.
I think the problem are the language files. So I put the variables in the function.
If you can't understand that, I will write an tutorial for fixing the problem.

---------

Hallo ich habe die selben Probleme mit der Textausgabe. Ich glaube das Problem gefunden zu haben und habe mir nun ein Workaround gebastelt. Das Problem hängt scheinbar mit dem Aufruf der Language- Dateien zusammen. Also erspare ich mir diesen Aufruf und setze die Übersetzung direkt in die Funktion.
In den nächsten Tagen werde ich hier ein Tutorial posten.

Mfg

Yast
Title: Re: [Mod] Photo Of The Day
Post by: Chicco on May 02, 2006, 11:04:07 AM
Ein Tut darüber, das nun auch endlich der entsprechende Text angezeigt wird, wenn man lang_potd_type verwendet? Also je nach typ wird auch "nach Hits" "nach Downloads" usw. angezeigt?

Prima. :lol:
Title: Re: [Mod] Photo Of The Day
Post by: adizlaja on May 07, 2006, 01:16:47 AM
Any way to change it from photo of the day to photo of the week?

thanks
Title: Re: [Mod] Photo Of The Day
Post by: Chicco on May 08, 2006, 10:00:34 AM
Also ich habe nun mal manche Mitglieder gefragt, bei denen dieser Mod wunderbar funktioniert und festgestellt, das diese aber alle noch die 1.7.0 Version betreiben. Keine 1.7.1 oder 1.7.2.  Jetzt müsste man quasi anfangen, herauszufinden, was sich so gross bei der 1.7l.1 Version gegenüber der 1.7.0 geändert hat und darin evtl. das Problem finden, was daran schuld ist, das diese Random-Funktion in Sache dazugehöriger Text nicht funktioniert. 8O

Oder liege ich falsch?
Title: Re: [Mod] Photo Of The Day
Post by: kyzer on May 18, 2006, 07:03:37 PM
Hi... :wink: Eih I added this Mod to my gallery, and my gallery is not working anymore...
it was working fine... and I installed as is says in the install file...
the error is this one...

Parse error: parse error, unexpected $ in /home/docelarm/public_html/acoresxtreme/galeria/includes/functions.php on line 585
can you help me with this???
thanks... :|
Title: Re: [Mod] Photo Of The Day
Post by: kyzer on May 19, 2006, 12:05:39 AM
 :mrgreen: oops... my mistake...
problem solved...
Title: Re: [Mod] Photo Of The Day
Post by: Chicco on May 23, 2006, 02:38:42 PM
Habe nun vor kurzem eine 4images-Homepage entdeckt, die bereits auf 1.7.2 Version läuft und ebenfalls diesen Mod beinhaltet. Dort allerdings funktioniert das mit dem Random. Der entsprechende Text wird auch angezeigt!Also doch nicht Versionsabhängig! :evil:

Zum Mäusemelken!! :x
Title: Re: [Mod] Photo Of The Day
Post by: Stoleti on June 26, 2006, 10:10:00 PM
Can this Mod be only for a especific categories ?
Title: Re: [Mod] Photo Of The Day
Post by: paburmester on September 20, 2006, 09:36:21 AM
Code: [Select]
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM 4images_images i, 4images_categories c LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND c.cat_id = i.cat_id ORDER BY i.image_comments DESC LIMIT 1
Unknown column 'i.user_id' in 'on clause'
How can I fix that? Please help me!
Regards,
Title: Re: [Mod] Photo Of The Day
Post by: Zhra on November 16, 2006, 06:07:44 PM
I think the script don't works with version 1.7.4
Title: Re: [Mod] Photo Of The Day
Post by: Yast on November 27, 2006, 08:36:26 PM
The mod runs without problems in the new version, too. WIth random sort and so on.
Title: Re: [Mod] Photo Of The Day
Post by: Alessio on December 15, 2006, 12:08:24 AM
After installing this mod these errors has occurred

Quote
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM 4images_images i, 4images_categories c LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND c.cat_id = i.cat_id ORDER BY i.image_downloads DESC LIMIT 1
Unknown column 'i.user_id' in 'on clause'

Notice: Undefined index: image_rating in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 336

Notice: Undefined index: image_rating in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 338

Notice: Undefined index: image_rating in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 340

Notice: Undefined index: image_rating in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 342

Notice: Undefined index: image_rating in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 344

Notice: Undefined index: image_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 361

Notice: Undefined index: image_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 366

Notice: Undefined index: cat_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 374

Notice: Undefined index: image_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 378

Notice: Undefined index: cat_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 388

Notice: Undefined index: cat_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 395

Notice: Undefined index: image_media_file in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 400

Notice: Undefined index: image_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 421

Notice: Undefined index: user_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 422

Notice: Undefined index: image_name in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 425

Notice: Undefined index: image_date in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 428

Notice: Undefined index: image_active in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 431

Notice: Undefined index: cat_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 432

Notice: Undefined index: cat_name in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 433

Notice: Undefined index: cat_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 434

Notice: Undefined index: image_downloads in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 435

Notice: Undefined index: image_votes in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 436

Notice: Undefined index: image_rating in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 437

Notice: Undefined index: image_hits in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 438

Notice: Undefined index: image_download_url in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 446

Notice: Undefined index: image_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 448

Notice: Undefined index: image_media_file in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 451

Notice: Undefined index: image_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 451

Notice: Undefined index: cat_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 451

Notice: Undefined index: image_name in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 451

Notice: Undefined index: image_media_file in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 452

Notice: Undefined index: image_thumb_file in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 452

Notice: Undefined index: image_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 452

Notice: Undefined index: cat_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 452

Notice: Undefined index: image_name in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 452

Notice: Undefined index: image_media_file in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 453

Notice: Undefined index: image_thumb_file in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 453

Notice: Undefined index: image_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 453

Notice: Undefined index: cat_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 453

Notice: Undefined index: image_name in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 453

Notice: Undefined index: image_media_file in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 454

Notice: Undefined index: image_thumb_file in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 455

Notice: Undefined index: cat_id in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/includes/functions.php on line 470


Title: Re: [Mod] Photo Of The Day
Post by: 1Newbie on December 21, 2006, 05:18:31 AM
Hi, I downloaded the file from your website for Photo of the day and followed the instructions inside the compressed file.
I'm getting error:

Parse error: syntax error, unexpected $end in /home/MYNAME/public_html/gallery/includes/functions.php on line 38

Here are Lines 36, 37, 38, 39 and 40:

return;   }    $token = serialize(md5($token));    if (isset
($download_token[$token])) {     unset($download_token[$token]);    
$site_sess->set_session_var('download_token', serialize
($download_token));   } }  function check_download_token($token) {
global $site_sess, $user_info;    if ($user_info['user_level'] ==


I used Wordpad for my editing.
Also I just want to make sure that this file: potd_image.html goes in to the templates directory and not the template current being used directory.  I have it in the templates directory as instructed in the instructions.

1Newbie.
Title: Re: [Mod] Photo Of The Day
Post by: CeJay on December 21, 2006, 07:58:12 AM
Quote
lso I just want to make sure that this file: potd_image.html goes in to the templates directory and not the template current being used directory.
Yes the potd_image.html goes in the template directory.
I don't know what you mean by "template current being used directory". I have never seen that or heard anything about that.



On my functions.php line 38 I only have:

Code: [Select]
    $download_token = array();I only have a few mods added so I couldn't tell you anymore then that.
Title: Re: [Mod] Photo Of The Day
Post by: 1Newbie on December 21, 2006, 06:17:49 PM
Quote
lso I just want to make sure that this file: potd_image.html goes in to the templates directory and not the template current being used directory.
Yes the potd_image.html goes in the template directory.
I don't know what you mean by "template current being used directory". I have never seen that or heard anything about that.

On my functions.php line 38 I only have:

Code: [Select]
    $download_token = array();I only have a few mods added so I couldn't tell you anymore then that.

CeJay, Thank you for your help.
I only have the Image Auto Resizer and the Images Moved and Edit Mod.

Anyone else have any ideas what the problem might be?

1Newbie.
Title: Re: [Mod] Photo Of The Day
Post by: CeJay on December 22, 2006, 12:32:12 AM
Do you have a back up of functions.php before you did the mod?

If so try moding that again and see if you get the same error.

If all else fails upload the original files before moding for this, then re-mod it all again.
If you read back 3 or 4 pages I had some issues doing this mod as well, but I redid it about 3 times and got it to work.
Title: Re: [Mod] Photo Of The Day
Post by: 1Newbie on December 26, 2006, 05:13:16 AM
Do you have a back up of functions.php before you did the mod?

If so try moding that again and see if you get the same error.

If all else fails upload the original files before moding for this, then re-mod it all again.
If you read back 3 or 4 pages I had some issues doing this mod as well, but I redid it about 3 times and got it to work.

CeJay, Thank you for your suggestion.  Did you ever figure out what it was giving you your problem?

Which program do you use when you do your editing of PHP files?  Is Wordpad okay to use?

1Newb
Title: Re: [Mod] Photo Of The Day
Post by: CeJay on December 27, 2006, 08:01:13 PM
Quote
CeJay, Thank you for your suggestion.  Did you ever figure out what it was giving you your problem?

Which program do you use when you do your editing of PHP files?  Is Wordpad okay to use?
I never found out what was causing the error, except for something I must have did. Because after re-doing it a few times and then double checking everytime I was able to get it to work. Since then I have installed this mod on 3 other friends 4images for them and have had no problems with the install.

I originally used wordpad and found it was better to actually use a php editor.
What I use now is PHP Designer 2007 and have not had any problems since I got that.
Title: Re: [Mod] Photo Of The Day
Post by: vuong184 on January 28, 2007, 09:22:53 AM
Mysite not a title Photo of the day under random images
Demo: http://emtoi.org/gallery/index.php
Help me
Title: Re: [Mod] Photo Of The Day
Post by: CeJay on January 29, 2007, 01:34:03 AM
Mysite not a title Photo of the day under random images
Demo: http://emtoi.org/gallery/index.php
Help me
As explained earlier in this thread:
http://www.4homepages.de/forum/index.php?topic=3529.135
Title: Re: [Mod] Photo Of The Day
Post by: NBX on January 30, 2007, 02:38:40 PM
Hi, i really need this plugin, but i have a problem - It shows:
"An unexpected error occured. Please try again later."
and the picture shows 404 error..
What did i do wrong?

Thanks!
Title: Re: [Mod] Photo Of The Day
Post by: CeJay on January 30, 2007, 07:37:46 PM
Hi, i really need this plugin, but i have a problem - It shows:
"An unexpected error occured. Please try again later."
and the picture shows 404 error..
What did i do wrong?

Thanks!
Restore back ups and try again. This mod does work so there must be a problem when you insterted code somewhere.
Title: Re: [Mod] Photo Of The Day
Post by: shadowhunter on February 03, 2007, 11:25:23 PM
Hallo
Wie kann ich auf der Hauptseite der Galerie dieses Script mit 4 verschiedenen Kriterien (Most Viewed, Rated, Voted, Commented) horizontal (wie "Neue Bilder") einbinden? Bis anhing konnte man ja nur ein Kriterum auswählen... Ich hoffe, dass mir jemand weiterhelfen kann.
Wäre sehr dankbar für Lösungen!
mfg shadow hunter
Title: Re: [Mod] Photo Of The Day
Post by: Loda on February 04, 2007, 09:38:56 AM
hallo!
ich glaube, du suchst dann lieber hier im forum nach "mini top"
Title: Re: [Mod] Photo Of The Day
Post by: darvid on April 05, 2007, 09:16:45 PM
this mod works definetly with 4images 1.7.4 !! though, there is still one bug which causes in the newer versions problems with the mysql queries, wich were mentioned before. here is the work-around i found (http://www.4homepages.de/forum/index.php?topic=5874.msg74179#msg74179), because the author of the script hasnt done this update in all of his scripts yet.


OPEN
includes/functions.php

FIND (in my functions.php at line 578)
FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c

REPLACE WITH
FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)

THATS IT!! - SAVE AND UPDATE FILE ON SERVER
Title: Re: Mebbernind!
Post by: darvid on July 05, 2007, 10:11:53 PM
Mebbernind!

I think I have it figured out with the help of a couple of friends....

Code: [Select]
<?php

/**************************************************************************
*                                                                        *
*    4images - A Web Based Image Gallery Management System               *
*    ----------------------------------------------------------------    *
*                                                                        *
*             File: potd.php                                           *
*        Copyright: (C) 2002 Jan Sorgalla                                *
*            Email: jan@4homepages.de                                    *
*              Web: http://www.4homepages.de                             *
*    Scriptversion: 1.0 for 4images 1.7                                *
*                                                                        *
*    Never released without support from: Nicky (http://www.nicky.net) and SLL (;   *
*                                                                        *
**************************************************************************
*                                                                        *
*    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
*    bedingungen (http://www.4homepages.de/4images/lizenz.php) für       *
*    weitere Informationen.                                              *
*    ---------------------------------------------------------------     *
*    This script is NOT freeware! Please read the Copyright Notice       *
*    (http://www.4homepages.de/4images/lizenz_e.php) for further         *
*    information.                                                        *
*                                                                        *
*************************************************************************/
//Based on the Photo of the Day mod by SLL and V@no
//additional tweaking by Omnirayf 9-5-2003

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH''./4images/');
//include(ROOT_PATH.'global.php');
include(ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');

$site_db = new Db($db_host$db_user$db_password$db_name);
function 
is_remote($file_name) {
  return (
preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i'$file_name)) ? 0;
}
    switch (
POTD_SELECT_MODE) {
   case 
"by_rating"     $select_mode "i.image_rating"$select_mode2 ", i.image_votes DESC"; break;
   case 
"by_votes"      $select_mode "i.image_votes"$select_mode2 ", i.image_name ASC"; break;
   case 
"by_comments"   $select_mode "i.image_comments"$select_mode2 ", i.image_name ASC"; break;
   case 
"by_downloads"  $select_mode "i.image_downloads"$select_mode2 ", i.image_name ASC"; break;
   case 
"by_hits"                $select_mode "i.image_hits"$select_mode2 ", i.image_name ASC"; break;
   default                             : 
$select_mode "i.image_rating"$select_mode2 ", i.image_votes DESC"; break;
}

$sql "SELECT COUNT(*) as total_images
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_date<"
.mktime(000date("m"), date("d"), date("y"))."
AND a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL."
        "
;
$row $site_db->query_firstrow($sql);
$total_images $row['total_images'];

mt_srand(mktime(000date("m"), date("d"), date("y")));
$number = ($total_images 1) ? mt_rand(0$total_images 1) : 0;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments 
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_date<"
.mktime(000date("m"), date("d"), date("y"))."
AND a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL.
        LIMIT 
$number, 1";
$row $site_db->query_firstrow($sql);
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name $row['image_name'];
$image_comments $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo 
"<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><center><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo 
"<b>$image_name</b><br>\n";
echo 
"Comments: $image_comments</center></td></tr></table>\n";
?>

Copy this code to Notepad or Homesite or UltraEdit, rename to potd.php, toss it in your root directory, and then test it by direct url call. You should get any old pic in your 4images database, regardless of stats. Refresh, and the pic should remain the same. After midnight of the date you implement the mod, the pic should change to another random pic for another 24 hours.

This mod has been optimized for people who are using Postnuke or PhpNuke and want a Photo of the Day block. Just make a new php script block and put this into it:
Code: [Select]
include("http://www.your-own-site.com/potd.php");
?>
It works, believe me, especially if you are using Postnuke. Otherwise, if you are having problems with it, add the opening <?php tag.

Let me know if it works for you, as it works for me. This way I can go and slap my friends for their help. :wink:


Hi,

i wanted to have the REAL Photo of the day for 24 hours, too.

How to do that on an extern page was told in the thread i mention. It isnt much do do, if u want to have it in your template.

Replace the code in the functions.php with:

Code: [Select]
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

function get_potd_image() {
    global $site_db, $site_template, $select_mode;

$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");

    switch (POTD_SELECT_MODE) {
   case "by_rating"     : $select_mode = "i.image_rating"; $select_mode2 = ", i.image_votes DESC"; break;
   case "by_votes"      : $select_mode = "i.image_votes"; $select_mode2 = ", i.image_name ASC"; break;
   case "by_comments"   : $select_mode = "i.image_comments"; $select_mode2 = ", i.image_name ASC"; break;
   case "by_downloads"  : $select_mode = "i.image_downloads"; $select_mode2 = ", i.image_name ASC"; break;
   case "by_hits"                : $select_mode = "i.image_hits"; $select_mode2 = ", i.image_name ASC"; break;
   default                             : $select_mode = "i.image_rating"; $select_mode2 = ", i.image_votes DESC"; break;
}

$sql = "SELECT COUNT(*) as total_images
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_date<".mktime(0, 0, 0, date("m"), date("d"), date("y"))."
AND a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
        ";
$row = $site_db->query_firstrow($sql);
$total_images = $row['total_images'];

mt_srand(mktime(0, 0, 0, date("m"), date("d"), date("y")));
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_date<".mktime(0, 0, 0, date("m"), date("d"), date("y"))."
AND a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
        LIMIT $number, 1";
$row = $site_db->query_firstrow($sql);
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><center><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo "<b>$image_name</b><br>\n";
echo "Comments: $image_comments</center></td></tr></table>\n";

  $potd_image = $site_db->query_firstrow($sql);
$site_db->free_result();
$template = 'potd_image';
show_image($potd_image, "", 1);
$potd_image = $site_template->parse_template($template);
}

//-----------------------------------------------------


Now it is shown in the template, but i dont know yet, how to use it with the {potd_image}


---EDIT---

ok I tried to add the following code and it works almost:

Code: [Select]
$potd_image = $site_db->query_firstrow($sql);
$site_db->free_result();
$template = 'potd_image';
show_image($potd_image, "", 1);
$potd_image = $site_template->parse_template($template);
return $potd_image;

any idea?
Title: Re: [Mod] Photo Of The Day
Post by: Anderson on July 20, 2007, 04:02:03 PM
I did everything, but it is showing only the image of the day and its name, the title and the type is not shown in the page...

I mean {lang_potd_title} and {lang_potd_type} are not showing anything... I don't know why...

Any ideas?

My album is at: www.fotosdoanderson.1br.net
or www.caclipperwebsite.com/fotos/

Please help.
Title: Re: [Mod] Photo Of The Day
Post by: Anderson on July 23, 2007, 05:14:27 AM
I did a workaround to solve my problem... I had just included the source code of the template (potd_image.html) in the place where I would put {potd_image} and i work out.

But it didn't seem to be a Photo of the Day... as I have selected by rate and it shows a picture without any rate as the Photo of the Day... funny, isn't it?!
Title: Re: [Mod] Photo Of The Day
Post by: Crazy_Boys on September 23, 2007, 08:48:56 PM
Ich habe das Mod eingebaut, Leider wird bei mir dies infos nicht angezeigt.Ich habe alles perfeckt eingebaut, ich benutze 1.74

Photo Of The Day
Selected by rating
Selected by votes
Selected by hits
Selected by comments
Selected by downloads

Mfg
Title: Re: [Mod] Photo Of The Day
Post by: skiemor on September 27, 2007, 09:41:37 PM
Ich benutze 1.74. Die Informationen für {lang_potd_title} {lang_potd_type} werden nicht angezeigt.
Auch andere {lang_***} werden nicht eingetragen.
Wenn ich normalen Text eingebe, z.B. "Bild" des Monats und "nach Bewertungen" erscheint der Text.
Wie ich gelesen habe, ist das Problem bei anderen Usern auch aufgetreten. Eine Lösung konnte ich leider dafür
hier noch nicht finden. Kann jemand helfen?
Title: Re: [Mod] Photo Of The Day
Post by: Icemann71 on September 27, 2007, 10:00:09 PM
Ich benutze 1.74. Die Informationen für {lang_potd_title} {lang_potd_type} werden nicht angezeigt.
Auch andere {lang_***} werden nicht eingetragen.
Wenn ich normalen Text eingebe, z.B. "Bild" des Monats und "nach Bewertungen" erscheint der Text.
Wie ich gelesen habe, ist das Problem bei anderen Usern auch aufgetreten. Eine Lösung konnte ich leider dafür
hier noch nicht finden. Kann jemand helfen?


potd_image.html
Code: [Select]
{thumbnail}<br /><b>{image_name}</b>{if image_is_new} <sup class="new">{lang_new}</sup>{endif image_is_new}<br />
{if allow_comments}{lang_comments} {image_comments}{endif allow_comments}<br />{user_name}
hiermit ersetzen

home.html
find
Code: [Select]
{potd_image}ersetze durch
Code: [Select]
<table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20">
<p align="center"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_potd_title}<br>{lang_potd_type}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">
    <br />
                       {potd_image}
<br />
                        <br />
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
Title: Re: [Mod] Photo Of The Day
Post by: skiemor on September 27, 2007, 10:27:54 PM
He, das ist ja kaum zu glauben! So eine schnelle Antwort und es klappt auch noch wunderbar!  :D
Ich danke dir vielmals!!!!!!

Gruß.
Title: Re: [Mod] Photo Of The Day
Post by: matosale on October 11, 2007, 02:38:22 PM
Hi!

I made the changes you suggested but it doesn't look ok, take a look at it:

(http://img255.imageshack.us/img255/1484/potdpn5.th.jpg) (http://img255.imageshack.us/my.php?image=potdpn5.jpg)

Thanks in advance!
Title: Re: Mebbernind!
Post by: cloe on January 23, 2008, 03:23:44 AM
Mebbernind!

I think I have it figured out with the help of a couple of friends....

Code: [Select]
<?php

/**************************************************************************
*                                                                        *
*    4images - A Web Based Image Gallery Management System               *
*    ----------------------------------------------------------------    *
*                                                                        *
*             File: potd.php                                           *
*        Copyright: (C) 2002 Jan Sorgalla                                *
*            Email: jan@4homepages.de                                    *
*              Web: http://www.4homepages.de                             *
*    Scriptversion: 1.0 for 4images 1.7                                *
*                                                                        *
*    Never released without support from: Nicky (http://www.nicky.net) and SLL (;   *
*                                                                        *
**************************************************************************
*                                                                        *
*    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
*    bedingungen (http://www.4homepages.de/4images/lizenz.php) für       *
*    weitere Informationen.                                              *
*    ---------------------------------------------------------------     *
*    This script is NOT freeware! Please read the Copyright Notice       *
*    (http://www.4homepages.de/4images/lizenz_e.php) for further         *
*    information.                                                        *
*                                                                        *
*************************************************************************/
//Based on the Photo of the Day mod by SLL and V@no
//additional tweaking by Omnirayf 9-5-2003

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH''./4images/');
//include(ROOT_PATH.'global.php');
include(ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');

$site_db = new Db($db_host$db_user$db_password$db_name);
function 
is_remote($file_name) {
  return (
preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i'$file_name)) ? 0;
}
    switch (
POTD_SELECT_MODE) {
   case 
"by_rating"     $select_mode "i.image_rating"$select_mode2 ", i.image_votes DESC"; break;
   case 
"by_votes"      $select_mode "i.image_votes"$select_mode2 ", i.image_name ASC"; break;
   case 
"by_comments"   $select_mode "i.image_comments"$select_mode2 ", i.image_name ASC"; break;
   case 
"by_downloads"  $select_mode "i.image_downloads"$select_mode2 ", i.image_name ASC"; break;
   case 
"by_hits"                $select_mode "i.image_hits"$select_mode2 ", i.image_name ASC"; break;
   default                             : 
$select_mode "i.image_rating"$select_mode2 ", i.image_votes DESC"; break;
}

$sql "SELECT COUNT(*) as total_images
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_date<"
.mktime(000date("m"), date("d"), date("y"))."
AND a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL."
        "
;
$row $site_db->query_firstrow($sql);
$total_images $row['total_images'];

mt_srand(mktime(000date("m"), date("d"), date("y")));
$number = ($total_images 1) ? mt_rand(0$total_images 1) : 0;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments 
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_date<"
.mktime(000date("m"), date("d"), date("y"))."
AND a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL.
        LIMIT 
$number, 1";
$row $site_db->query_firstrow($sql);
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name $row['image_name'];
$image_comments $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo 
"<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><center><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo 
"<b>$image_name</b><br>\n";
echo 
"Comments: $image_comments</center></td></tr></table>\n";
?>

Copy this code to Notepad or Homesite or UltraEdit, rename to potd.php, toss it in your root directory, and then test it by direct url call. You should get any old pic in your 4images database, regardless of stats. Refresh, and the pic should remain the same. After midnight of the date you implement the mod, the pic should change to another random pic for another 24 hours.

This mod has been optimized for people who are using Postnuke or PhpNuke and want a Photo of the Day block. Just make a new php script block and put this into it:
Code: [Select]
include("http://www.your-own-site.com/potd.php");
?>
It works, believe me, especially if you are using Postnuke. Otherwise, if you are having problems with it, add the opening <?php tag.

Let me know if it works for you, as it works for me. This way I can go and slap my friends for their help. :wink:


Hi,

i wanted to have the REAL Photo of the day for 24 hours, too.

How to do that on an extern page was told in the thread i mention. It isnt much do do, if u want to have it in your template.

Replace the code in the functions.php with:

Code: [Select]
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

function get_potd_image() {
    global $site_db, $site_template, $select_mode;

$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");

    switch (POTD_SELECT_MODE) {
   case "by_rating"     : $select_mode = "i.image_rating"; $select_mode2 = ", i.image_votes DESC"; break;
   case "by_votes"      : $select_mode = "i.image_votes"; $select_mode2 = ", i.image_name ASC"; break;
   case "by_comments"   : $select_mode = "i.image_comments"; $select_mode2 = ", i.image_name ASC"; break;
   case "by_downloads"  : $select_mode = "i.image_downloads"; $select_mode2 = ", i.image_name ASC"; break;
   case "by_hits"                : $select_mode = "i.image_hits"; $select_mode2 = ", i.image_name ASC"; break;
   default                             : $select_mode = "i.image_rating"; $select_mode2 = ", i.image_votes DESC"; break;
}

$sql = "SELECT COUNT(*) as total_images
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_date<".mktime(0, 0, 0, date("m"), date("d"), date("y"))."
AND a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
        ";
$row = $site_db->query_firstrow($sql);
$total_images = $row['total_images'];

mt_srand(mktime(0, 0, 0, date("m"), date("d"), date("y")));
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_date<".mktime(0, 0, 0, date("m"), date("d"), date("y"))."
AND a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
        LIMIT $number, 1";
$row = $site_db->query_firstrow($sql);
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><center><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo "<b>$image_name</b><br>\n";
echo "Comments: $image_comments</center></td></tr></table>\n";

  $potd_image = $site_db->query_firstrow($sql);
$site_db->free_result();
$template = 'potd_image';
show_image($potd_image, "", 1);
$potd_image = $site_template->parse_template($template);
}

//-----------------------------------------------------


Now it is shown in the template, but i dont know yet, how to use it with the {potd_image}


---EDIT---

ok I tried to add the following code and it works almost:

Code: [Select]
$potd_image = $site_db->query_firstrow($sql);
$site_db->free_result();
$template = 'potd_image';
show_image($potd_image, "", 1);
$potd_image = $site_template->parse_template($template);
return $potd_image;

any idea?

If I understand this right is this the way to make the real Photo Og The Day... so the higest rated image will be shown even if another image is higher rated.. And it will reset things at 12 o'clock every night.. And find the next image that has been submitted the last 24 hour that has the highest rating??

I really hope that this is the answer.. and that someone can figure out what to do to make this work.. That would really make this Photo Of The Day a perfect MOD..

And that is what I need for my site.. Please can someone help?? 

If it is so... I wolud really get this to work... I really hope that someone can help me here.. ???
Title: Re: [Mod] Photo Of The Day
Post by: cloe on January 23, 2008, 10:01:23 PM
Isnt it anyone here that can make this mod work?? the way I have descibed over here??

Pleeease.. It would really make my day :)
Title: Re: [Mod] Photo Of The Day
Post by: masterred on January 29, 2008, 05:27:07 PM
this mod works definetly with 4images 1.7.4 !! though, there is still one bug which causes in the newer versions problems with the mysql queries, wich were mentioned before. here is the work-around i found (http://www.4homepages.de/forum/index.php?topic=5874.msg74179#msg74179), because the author of the script hasnt done this update in all of his scripts yet.


OPEN
includes/functions.php

FIND (in my functions.php at line 578)
FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c

REPLACE WITH
FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)

THATS IT!! - SAVE AND UPDATE FILE ON SERVER


i have this error

this is the original script in functions.php

Quote
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

function get_potd_image() {
    global $site_db, $site_template, $select_mode;

$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");

switch (POTD_SELECT_MODE) {
   case "rating"      :   $select_mode = "i.image_rating"; break;
   case "votes"      :   $select_mode = "i.image_votes"; break;
   case "comments"   :   $select_mode = "i.image_comments"; break;
   case "downloads"   :   $select_mode = "i.image_downloads"; break;
   case "hits"      :   $select_mode = "i.image_hits"; break;
   case "random"      :   $selection = array('rating', 'votes', 'hits', 'comments', 'downloads');
                     mt_srand((double) microtime() * 1000000);
                     $select_mode = 'i.image_'.$selection[mt_rand(0, (count($selection)-1))];
                     break;
}

    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            ORDER BY $select_mode DESC LIMIT 1";

    $potd_image = $site_db->query_firstrow($sql);
   $site_db->free_result();
   $template = 'potd_image';
   show_image($potd_image, "", 1);
   $potd_image = $site_template->parse_template($template);
   return $potd_image;
}

//-----------------------------------------------------

modify

Quote
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

function get_potd_image() {
    global $site_db, $site_template, $select_mode;

$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");

switch (POTD_SELECT_MODE) {
   case "rating"      :   $select_mode = "i.image_rating"; break;
   case "votes"      :   $select_mode = "i.image_votes"; break;
   case "comments"   :   $select_mode = "i.image_comments"; break;
   case "downloads"   :   $select_mode = "i.image_downloads"; break;
   case "hits"      :   $select_mode = "i.image_hits"; break;
   case "random"      :   $selection = array('rating', 'votes', 'hits', 'comments', 'downloads');
                     mt_srand((double) microtime() * 1000000);
                     $select_mode = 'i.image_'.$selection[mt_rand(0, (count($selection)-1))];
                     break;
}

    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            ORDER BY $select_mode DESC LIMIT 1";

    $potd_image = $site_db->query_firstrow($sql);
   $site_db->free_result();
   $template = 'potd_image';
   show_image($potd_image, "", 1);
   $potd_image = $site_template->parse_template($template);
   return $potd_image;
}

//-----------------------------------------------------

and error with modify

Quote
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM 4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND c.cat_id = i.cat_id ORDER BY i.image_votes DESC LIMIT 1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LEFT JOIN 4images_users u ON (u.user_id = i.user_id) ' at line 2

i need you help thanks




Title: Re: [Mod] Photo Of The Day
Post by: masterred on January 29, 2008, 07:21:00 PM
hi

thanks problem is solved
Title: Re: [Mod] Photo Of The Day
Post by: masumcis on February 09, 2008, 02:49:19 PM
hi i m new here, i add ur mod, and it works fine but is there any way i can select the pic fo the day.
Title: Re: [Mod] Photo Of The Day
Post by: masterred on February 10, 2008, 04:48:19 AM
hi

Photo of the day is selected through visits to the photo is selected automatically.
Title: Re: [Mod] Photo Of The Day
Post by: masumcis on February 14, 2008, 12:30:05 PM
hi

Photo of the day is selected through visits to the photo is selected automatically.

but if i want to select 1 pic what to do.
Title: Re: [Mod] Photo Of The Day
Post by: scorpi1 on August 28, 2008, 07:54:36 PM
ı want select photo of the day in admin panel.can we do?
Title: Ynt: [Mod] Photo Of The Day
Post by: sanko86 on January 25, 2009, 02:00:45 PM
25.01.2009 fix

for 1.7.6
language turkish

read kurulum.doc
Title: Re: [Mod] Photo Of The Day
Post by: SolidSnake0308 on February 16, 2009, 12:22:08 AM
Funktioniert die Mod auch mit 1.7.6? Glaube anscheinend nicht, denn nach der Installation kommt ein Fehler, nachdem ich die "page_header.php" eingefügt habe. Woran kann das liegen?!

Hoffe auf eine schnelle Hilfe.
Title: Re: [Mod] Photo Of The Day
Post by: d1eter on February 20, 2009, 08:29:39 AM
my potd_title and potd_type also not showing...
please help...

http://batamphotoclub.co.cc


Title: Re: [Mod] Photo Of The Day
Post by: V@no on February 20, 2009, 03:57:09 PM
You either didn't do properly steps with modification of
includes/page_header.php (doubtful)
and/or
lang/<your language>/main.php (most likely)
Title: Re: [Mod] Photo Of The Day
Post by: d1eter on February 21, 2009, 02:16:15 AM
You either didn't do properly steps with modification of
includes/page_header.php (doubtful)
and/or
lang/<your language>/main.php (most likely)

I just copy-paste.
I'll check again.

thanx for the hints.

added: finished checking.
it's all there.. code by code, character by character.

in the /lang/english/main.php , the POTD codes are after the last comment code..  like this..

Code: [Select]
$lang['last_comments'] = "Last comments";
$lang['last_comments_more'] = "More comments";


//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

$lang['potd_title'] = "Photo Of The Day";
$lang['potd_type_rating'] = "Selected by rating";
$lang['potd_type_votes'] = "Selected by votes";
$lang['potd_type_hits'] = "Selected by hits";
$lang['potd_type_comments'] = "Selected by comments";
$lang['potd_type_downloads'] = "Selected by downloads";

?>

and this is my page_header.php
Code: [Select]
$site_template->register_vars("category_dropdown_form", $category_dropdown_form);
unset($category_dropdown_form);

//-----------------------------------------------------
//--- Random Image ------------------------------------
//-----------------------------------------------------
$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$site_template->register_vars("random_image", $random_image);
unset($random_image);


//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

$potd_image = (defined("SHOW_POTD_IMAGE") && SHOW_POTD_IMAGE == 0) ? "" : get_potd_image();
$site_template->register_vars("potd_image", $potd_image);
$site_template->register_vars(array("lang_potd_title" => $lang['potd_title']));
$site_template->register_vars(array("lang_potd_type" => $lang['potd_type_'.ereg_replace ("i.image_", "", $select_mode)]));
unset($potd_image);

//--- End Photo Of The Day ----------------------------



//-----------------------------------------------------
//--- Set Paging Vars --


anything else I'm missing..?

my POTD is in the right menu of the main page, under the Announcement section.
Title: Re: [Mod] Photo Of The Day
Post by: V@nо on February 21, 2009, 06:01:59 AM
Ok, since you are not using "standard" template you must add code in page_header.php above first parse_template
Title: Re: [Mod] Photo Of The Day
Post by: d1eter on February 22, 2009, 07:56:01 AM
I see several parse_template in the file..

this is my full page_header.
in which line should I insert the POTD codes..?

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: page_header.php                                      *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die(
"Security violation");
}

// Cache Templates
/*$template_list = 'header,footer,category_dropdown_form,user_logininfo,user_loginform';
if (isset($templates_used) && $templates_used != "") {
  $template_list = $template_list.",".$templates_used;
}
$site_template->cache_templates($template_list);*/

//-----------------------------------------------------
//--- Register Global Vars ----------------------------
//-----------------------------------------------------
$total_images 0;
$total_categories 0;
$auth_cat_sql['auth_viewcat']['IN'] = 0;
$auth_cat_sql['auth_viewcat']['NOTIN'] = 0;

$cache_id create_cache_id(
  
'data.auth_and_info',
  array(
$user_info[$user_table_fields['user_id']])
);

if (!
$data get_cache_file($cache_idnull)) {
  if (!empty(
$cat_cache)) {
    foreach (
$cat_cache as $key => $val) {
      if (
check_permission("auth_viewcat"$key)) {
        
$total_categories++;
        if (isset(
$val['num_images'])) {
          
$total_images += $val['num_images'];
        }
        else {
          
$cat_cache[$key]['num_images'] = 0;
        }
        
$auth_cat_sql['auth_viewcat']['IN'] .= ", ".$key;
      }
      else {
        
$auth_cat_sql['auth_viewcat']['NOTIN'] .= ", ".$key;
      }
    }
  }

  
$data = array();

  
$data['total_images'] = $total_images;
  
$data['total_categories'] = $total_categories;
  
$data['auth_viewcat']['IN'] = $auth_cat_sql['auth_viewcat']['IN'];
  
$data['auth_viewcat']['NOTIN'] = $auth_cat_sql['auth_viewcat']['NOTIN'];

  
save_cache_file($cache_idserialize($data));

} else {
  
$data unserialize($data);

  
$total_images $data['total_images'];
  
$total_categories $data['total_categories'];
  
$auth_cat_sql['auth_viewcat']['IN'] = $data['auth_viewcat']['IN'];
  
$auth_cat_sql['auth_viewcat']['NOTIN'] = $data['auth_viewcat']['NOTIN'];
}

$site_template->register_vars(array(
  
"media_url" => MEDIA_PATH,
  
"thumb_url" => THUMB_PATH,
  
"icon_url" => ICON_PATH,
  
"template_url" => TEMPLATE_PATH,
  
"template_image_url" => TEMPLATE_PATH."/images",
  
"template_lang_image_url" => TEMPLATE_PATH."/images_".$config['language_dir'],
  
"site_name" => $config['site_name'],
  
"site_email" => $config['site_email'],
  
"user_loggedin" => ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) ? 1,
  
"user_loggedout" => ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) ? 0,
  
"is_admin" => ($user_info['user_level'] == ADMIN) ? 0,
  
"self" => $site_sess->url($self_url),
  
"self_full" => $site_sess->url($script_url."/".$self_url),
  
"script_version" => SCRIPT_VERSION,
  
"cp_link" => ($user_info['user_level'] != ADMIN) ? "" "\n<p align=\"center\">[<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php")."\">Admin Control Panel</a>]</p>\n",
  
"total_categories" => $total_categories,
  
"total_images" => $total_images,
  
"url_new_images" => $site_sess->url(ROOT_PATH."search.php?search_new_images=1"),
  
"url_top_images" => $site_sess->url(ROOT_PATH."top.php"),
  
"url_top_cat_images" => $site_sess->url(ROOT_PATH."top.php".(($cat_id && preg_match("/categories.php/"$self_url)) ? "?".URL_CAT_ID."=".$cat_id "")),
  
"url_register" => (!empty($url_register)) ? $site_sess->url($url_register) : $site_sess->url(ROOT_PATH."register.php"),
  
"url_search" => $site_sess->url(ROOT_PATH."search.php"),
  
"url_lightbox" => $site_sess->url(ROOT_PATH."lightbox.php"),
  
"url_control_panel" => (!empty($url_control_panel)) ? $site_sess->url($url_control_panel) : $site_sess->url(ROOT_PATH."member.php?action=editprofile"),
  
"url_categories" => $site_sess->url(ROOT_PATH."categories.php"),
  
"url_home" => $site_sess->url(ROOT_PATH."index.php"),
  
"url_login" => (!empty($url_login)) ? $site_sess->url($url_login) : $site_sess->url(ROOT_PATH."login.php"),
  
"url_logout" => (!empty($url_logout)) ? $site_sess->url($url_logout) : $site_sess->url(ROOT_PATH."logout.php"),
  
"url_member" => (!empty($url_member)) ? $site_sess->url($url_member) : $site_sess->url(ROOT_PATH."member.php"),
  
"url_upload" => (!empty($url_upload)) ? $site_sess->url($url_upload) : $site_sess->url(ROOT_PATH."member.php?action=uploadform"),
  
"url_lost_password" => (!empty($url_lost_password)) ? $site_sess->url($url_lost_password) : $site_sess->url(ROOT_PATH."member.php?action=lostpassword"),
  
"url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),
  
"thumbnails" => "",
  
"paging" => "",
  
"paging_stats" => "",
  
"has_rss" => false,
  
"rss_title" => "",
  
"rss_url" => "",
  
"copyright" => '
<p id="copyright" align="center">
  Powered by <b>4images</b> '
.SCRIPT_VERSION.'
  <br />
  Copyright &copy; 2002-'
.date('Y').' <a href="http://www.4homepages.de" target="_blank">4homepages.de</a> and <a href="{url_home}/index.php?template=aboutus">Batam Photo Club</a>
</p>


'
,
));

if (!empty(
$additional_urls)) {
  
$register_array = array();
  foreach (
$additional_urls as $key => $val) {
    
$register_array[$key] = $site_sess->url($val);
  }
  
$site_template->register_vars($register_array);
}

// Replace Globals in $lang
$lang $site_template->parse_array($lang);

$site_template->register_vars(array(
  
"lang_site_stats" => $lang['site_stats'],
  
"lang_registered_user" => $lang['registered_user'],
  
"lang_random_image" => $lang['random_image'],
  
"lang_categories" => $lang['categories'],
  
"lang_sub_categories" => $lang['sub_categories'],
  
"lang_new_images" => $lang['new_images'],
  
"lang_top_images" => $lang['top_images'],
  
"lang_search" => $lang['search'],
  
"lang_advanced_search" => $lang['advanced_search'],
  
"lang_lightbox" => $lang['lightbox'],
  
"lang_register" => $lang['register'],
  
"lang_control_panel" => $lang['control_panel'],
  
"lang_login" => $lang['login'],
  
"lang_auto_login" => $lang['lang_auto_login'],
  
"lang_logout" => $lang['logout'],
  
"lang_lost_password" => $lang['lost_password'],
  
"lang_user_name" => $lang['user_name'],
  
"lang_password" => $lang['password'],
  
"lang_go" => $lang['go'],
  
"lang_images_per_page" => $lang['images_per_page'],
  
"charset" => $lang['charset'],
  
"direction" => $lang['direction']
));



//-----------------------------------------------------
//--- Category Dropdown -------------------------------
//-----------------------------------------------------

if (!$cache_enable) {
    
$category_dropdown_selfjump get_category_dropdown($cat_id1);
} else {
  
$cache_id create_cache_id(
    
'data.dropdown_selfjump',
    array(
      
$user_info[$user_table_fields['user_id']],
      
$config['template_dir'],
      
$config['language_dir']
    )
  );

  if (!
$category_dropdown_selfjump get_cache_file($cache_id)) {
    
// Always append session id if cache is enabled
    
$old_session_mode $site_sess->mode;
    
$site_sess->mode 'get';

    
// Set $cat_id to 0 to ensure that no category is selected
    
$category_dropdown_selfjump get_category_dropdown(01);

    
$site_sess->mode $old_session_mode;

    
save_cache_file($cache_id$category_dropdown_selfjump);
  }
}

$site_template->register_vars("category_dropdown_selfjump"$category_dropdown_selfjump);
unset(
$category_dropdown_selfjump);

// -------------------------------------
if (!$cache_enable) {
    
$category_dropdown_form $site_template->parse_template("category_dropdown_form");
} else {
  
$cache_id create_cache_id(
    
'data.dropdown_form',
    array(
      
$user_info[$user_table_fields['user_id']],
      
// $cat_id, // uncomment if the current category should be selected, will increase the number of cache files
      
$config['template_dir'],
      
$config['language_dir']
    )
  );

  if (!
$category_dropdown_form get_cache_file($cache_id)) {
    
// Always append session id if cache is enabled
    
$old_session_mode $site_sess->mode;
    
$site_sess->mode 'get';

    
$category_dropdown_form $site_template->parse_template("category_dropdown_form");

    
$site_sess->mode $old_session_mode;

    
save_cache_file($cache_id$category_dropdown_form);
  }
}

$site_template->register_vars("category_dropdown_form"$category_dropdown_form);
unset(
$category_dropdown_form);

//-----------------------------------------------------
//--- Random Image ------------------------------------
//-----------------------------------------------------
$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" get_random_image();
$site_template->register_vars("random_image"$random_image);
unset(
$random_image);



//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

$potd_image = (defined("SHOW_POTD_IMAGE") && SHOW_POTD_IMAGE == 0) ? "" get_potd_image();
$site_template->register_vars("potd_image"$potd_image);
$site_template->register_vars(array("lang_potd_title" => $lang['potd_title']));
$site_template->register_vars(array("lang_potd_type" => $lang['potd_type_'.ereg_replace ("i.image_"""$select_mode)]));
unset(
$potd_image);

//--- End Photo Of The Day ----------------------------



//-----------------------------------------------------
//--- Set Paging Vars ---------------------------------
//-----------------------------------------------------
if (isset($HTTP_POST_VARS['setperpage'])) {
  
$setperpage intval($HTTP_POST_VARS['setperpage']);
  if (
$setperpage) {
    
$site_sess->set_session_var("perpage"$setperpage);
    
$session_info['perpage'] = $setperpage;
  }
}

if (isset(
$session_info['perpage'])) {
  
$perpage $session_info['perpage'];
}
else {
  
$perpage ceil($config['default_image_rows'] * $config['image_cells']);
}

//-----------------------------------------------------
//--- Set Perpage Dropdown ----------------------------
//-----------------------------------------------------
$setperpage_dropdown "\n<select onchange=\"if (this.options[this.selectedIndex].value != 0 && typeof forms['perpagebox'] != 'undefined'){ forms['perpagebox'].submit() }\" name=\"setperpage\" class=\"setperpageselect\">\n";
for(
$i 1$i <= $config['custom_row_steps']; $i++) {
  
$setvalue $config['image_cells'] * $i;
  
$setperpage_dropdown .= "<option value=\"".$setvalue."\"";
    if (
$setvalue == $perpage) {
    
$setperpage_dropdown .= " selected=\"selected\"";
  }
  
$setperpage_dropdown .= ">";
  
$setperpage_dropdown .= $setvalue;
  
$setperpage_dropdown .= "</option>\n";
}
$setperpage_dropdown .= "</select>\n";
if (
$cat_id != 0) {
  
$setperpage_dropdown .= "<input type=\"hidden\" name=\"cat_id\" value=\"".$cat_id."\" />\n";
}
if (isset(
$show_result) && $show_result == 1) {
  
$setperpage_dropdown .= "<input type=\"hidden\" name=\"show_result\" value=\"1\" />\n";
}
$site_template->register_vars("setperpage_dropdown"$setperpage_dropdown);
$setperpage_dropdown_form $site_template->parse_template("setperpage_dropdown_form");
$site_template->register_vars("setperpage_dropdown_form"$setperpage_dropdown_form);

$site_template->un_register_vars("setperpage_dropdown");
unset(
$setperpage_dropdown);
unset(
$setperpage_dropdown_form);

//-----------------------------------------------------
//--- Add & Delete from Lists -------------------------
//-----------------------------------------------------
if ($action == "addtolightbox" && $id) {
  if (
$user_info['user_level'] >= USER) {
    
$msg = (add_to_lightbox($id)) ? $lang['lightbox_add_success'] : $lang['lightbox_add_error'];
  }
  else {
    
$msg $lang['lightbox_register'];
  }
}
if (
$action == "removefromlightbox" && $id) {
  if (
$user_info['user_level'] >= USER) {
    
$msg = (remove_from_lightbox($id)) ? $lang['lightbox_remove_success'] : $lang['lightbox_remove_error'];
  }
  else {
    
$msg $lang['lightbox_register'];
  }
}
if (
$action == "clearlightbox") {
  if (
$user_info['user_level'] >= USER) {
    
$msg = (clear_lightbox()) ? $lang['lightbox_delete_success'] : $lang['lightbox_delete_error'];
  }
  else {
    
$msg $lang['lightbox_register'];
  }
}

//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
if ($action == "rateimage" && $id) {
  
$rating intval($HTTP_POST_VARS['rating']);
  
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME "4images_";
  
$cookie_rated = isset($HTTP_COOKIE_VARS[$cookie_name.'rated']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'])) : array();
  if (
$rating && $rating <= MAX_RATING && $id) {
    if (!isset(
$session_info['rated_imgs'])) {
      
$session_info['rated_imgs'] = $site_sess->get_session_var("rated_imgs");
    }
    
$split_list = array();
    if (!empty(
$session_info['rated_imgs'])) {
      
$split_list explode(" "$session_info['rated_imgs']);
    }
    if (!
in_array($id$split_list) && !in_array($id$cookie_rated)) {
      
$session_info['rated_imgs'] .= " ".$id;
      
$session_info['rated_imgs'] = trim($session_info['rated_imgs']);
      
$site_sess->set_session_var("rated_imgs"$session_info['rated_imgs']);
      
$cookie_rated[] = $id;
      
$cookie_expire time() + 60 60 24 4;
      
setcookie($cookie_name.'rated'serialize($cookie_rated), $cookie_expireCOOKIE_PATHCOOKIE_DOMAINCOOKIE_SECURE);
      
update_image_rating($id$rating);
      
$msg $lang['voting_success'];
    }
    else {
      
$msg $lang['already_voted'];
    }
  }
  else {
    
$msg $lang['voting_error'];
  }
}

//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------
if ($user_info['user_level'] >= USER) {
  
$site_template->register_vars("lang_loggedin_msg"preg_replace("/".$site_template->start."loggedin_user_name".$site_template->end."/siU"format_text($user_info['user_name'], 2), $lang['lang_loggedin_msg']));
  
$user_box $site_template->parse_template("user_logininfo");
  
$site_template->register_vars(array(
    
"user_box" => $user_box,
    
"user_loggedin" => 1,
    
"user_loggedout" => 0,
    
"is_admin" => ($user_info['user_level'] == ADMIN) ? 0
  
));
  
$site_template->un_register_vars("user_logininfo");
  unset(
$user_box);
}
else {
  
$user_box $site_template->parse_template("user_loginform");
  
$site_template->register_vars(array(
    
"user_box" => $user_box,
    
"user_loggedin" => 0,
    
"user_loggedout" => 1,
    
"is_admin" => 0
  
));
  
$site_template->un_register_vars("user_loginform");
  unset(
$user_box);
}


//-------------------------------------------------------
//---- Start Mod: 3column template advanced by KurtW ----
//-------------------------------------------------------
if ($config['menue_table_left'] != '0')  {
$menue_table_left $site_template->parse_template("".$config['menue_table_left']."");
$menue_table_left_width $config['menue_table_left_width'];
$menue_table_left_view 'yes';
} else {
$menue_table_left '';
$menue_table_left_width '0';
$menue_table_left_view 'none';
}
if (
$config['menue_table_right'] != '0')  {
$menue_table_right $site_template->parse_template("".$config['menue_table_right']."");
$menue_table_right_width $config['menue_table_right_width'];
$menue_table_right_view 'yes';
} else {
$menue_table_right '';
$menue_table_right_width '0';
$menue_table_right_view 'none';
}
$page_table_width $config['page_table_width'];

 
$site_template->register_vars(array(
    
"menue_table_left" => $menue_table_left,
    
"menue_table_left_view" => $menue_table_left_view,
    
"menue_table_left_width" => $menue_table_left_width,
    
"menue_table_right" => $menue_table_right,
    
"menue_table_right_view" => $menue_table_right_view,
    
"menue_table_right_width" => $menue_table_right_width,
    
"page_table_width" => $config['page_table_width']
  ));
//---------------------------------------------------
//--- End Mod: 3column template advanced by KurtW ---
//---------------------------------------------------


?>

thanx!
Title: Re: [Mod] Photo Of The Day
Post by: V@no on February 22, 2009, 09:01:41 AM
Hmmmm never mind my previous suggestion...

The mod was built on 4images v1.7 since then the template engine was changed, and now the registering template tags must be done before parsing the template - and that what causing the problem.

What you need to do is replace in includes/page_header.php:
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

$potd_image = (defined("SHOW_POTD_IMAGE") && SHOW_POTD_IMAGE == 0) ? "" : get_potd_image();
$site_template->register_vars("potd_image", $potd_image);
$site_template->register_vars(array("lang_potd_title" => $lang['potd_title']));
$site_template->register_vars(array("lang_potd_type" => $lang['potd_type_'.ereg_replace ("i.image_", "", $select_mode)]));
unset($potd_image);

//--- End Photo Of The Day ----------------------------

With this:
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

$site_template->register_vars("potd_image", (defined("SHOW_POTD_IMAGE") && SHOW_POTD_IMAGE == 0) ? "" : get_potd_image());

//--- End Photo Of The Day ----------------------------



Then in includes/functions.php replace
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

function get_potd_image() {
    global $site_db, $site_template, $select_mode;

$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");

switch (POTD_SELECT_MODE) {
case "rating" : $select_mode = "i.image_rating"; break;
case "votes" : $select_mode = "i.image_votes"; break;
case "comments" : $select_mode = "i.image_comments"; break;
case "downloads" : $select_mode = "i.image_downloads"; break;
case "hits" : $select_mode = "i.image_hits"; break;
case "random" : $selection = array('rating', 'votes', 'hits', 'comments', 'downloads');
mt_srand((double) microtime() * 1000000);
$select_mode = 'i.image_'.$selection[mt_rand(0, (count($selection)-1))];
break;
}

    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            ORDER BY $select_mode DESC LIMIT 1";

  $potd_image = $site_db->query_firstrow($sql);
$site_db->free_result();
$template = 'potd_image';
show_image($potd_image, "", 1);
$potd_image = $site_template->parse_template($template);
return $potd_image;
}

//-----------------------------------------------------

With this:
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

function get_potd_image($selection = false)
{
  global $site_db, $site_template, $lang;

  if ($selection === false)
    $selection = POTD_SELECT_MODE;

  $selection = strtolower($selection);
  $selection_array = array('rating', 'votes', 'hits', 'comments', 'downloads');
  if ($selection != "random" && !in_array($selection, $selection_array))
    $selection = "rating";

  switch ($selection)
  {
    default       : $select_mode = "i.image_".$selection; break;
    case "random" : mt_srand((double) microtime() * 1000000);
                    $selection = $selection_array[mt_rand(0, (count($selection_array)-1))];
                    $select_mode = 'i.image_'.$selection;
             break;
  }

  $cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");
  $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
          FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
          WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
          ORDER BY $select_mode DESC LIMIT 1";
  if (!($potd_image = $site_db->query_firstrow($sql)))
    return;

  show_image($potd_image, "", 1);
  $site_template->register_vars(array(
    "lang_potd_title" => $lang['potd_title'],
    "lang_potd_type" => $lang['potd_type_'.$selection],
  ));
  $potd_image = $site_template->parse_template('potd_image');
  return $potd_image;
}

//--- End Photo Of The Day ----------------------------
Title: Re: [Mod] Photo Of The Day
Post by: d1eter on February 23, 2009, 12:10:43 AM
did as suggested.., there's a "An unexpected error occured. Please try again later."  in the top of default page.

and the POTD does not show at all.., 404 page not found.

I believe there's a small typo-error, should be:
Code: [Select]
    case "default":     $select_mode = "i.image_".POTD_SELECT_MODE; break;
Title: Re: [Mod] Photo Of The Day
Post by: V@no on February 23, 2009, 01:01:35 AM
Sorry about that, I've updated the code above.
Title: Re: [Mod] Photo Of The Day
Post by: d1eter on February 23, 2009, 02:45:03 AM
thanx V@no..,
excellent support as always..!

anyway.., the POTD title has a white color compared to the other title in the template which has yellow font.
how/where to change it to match the template..?

thanx!
Title: Re: [Mod] Photo Of The Day
Post by: fermachado on March 19, 2009, 02:03:03 PM
Absolut GREAT
here the full mod - thx to sll and v@no!!!
Quote
<?php
define('ROOT_PATH', './4images/');
define('SITE_URL', 'http://www.yourdomain.de/');

include_once(ROOT_PATH.'config.php');
include_once(ROOT_PATH.'includes/db_mysql.php');
include_once(ROOT_PATH.'includes/constants.php');

define('PIC_CATEGORIES_TABLE', '4images_categories');
define('PIC_IMAGES_TABLE', '4images_images');

$pics_db = new Db($db_host, $db_user, $db_password, $db_name);

function is_remote($file_name) {
  return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}

echo "<table width=\"100%\" border=\"0\" cellspacing=\"10\" cellpadding=\"1\"><tr>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits, a.user_id, u.user_name, u.user_id
        FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b, ".USERS_TABLE." u
        WHERE a.image_active=1 AND a.cat_id = b.cat_id AND u.user_id = a.user_id
        ORDER BY a.image_rating DESC
        LIMIT 1";

$row = $pics_db->query_firstrow($sql);
$image_id = $row['image_id'];
$user_name = $row['user_name'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<td align=\"center\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"><br>\n";
echo "<b>$image_name</b><br>\n";
echo "uploaded by <b>$user_name</b><br>\n";
echo "Top Rates</td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits, a.user_id, u.user_name, u.user_id
        FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b, ".USERS_TABLE." u
        WHERE a.image_active=1 AND a.cat_id = b.cat_id AND u.user_id = a.user_id
        ORDER BY a.image_votes DESC
        LIMIT 1";

$row = $pics_db->query_firstrow($sql);
$image_id = $row['image_id'];
$user_name = $row['user_name'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<td align=\"center\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"><br>\n";
echo "<b>$image_name</b><br>\n";
echo "uploaded by <b>$user_name</b><br>\n";
echo "Top Votes</td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits, a.user_id, u.user_name, u.user_id
        FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b, ".USERS_TABLE." u
        WHERE a.image_active=1 AND a.cat_id = b.cat_id AND u.user_id = a.user_id
        ORDER BY a.image_comments DESC
        LIMIT 1";

$row = $pics_db->query_firstrow($sql);
$image_id = $row['image_id'];
$user_name = $row['user_name'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<td align=\"center\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"><br>\n";
echo "<b>$image_name</b><br>\n";
echo "uploaded by <b>$user_name</b><br>\n";
echo "Top Kommentare</td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits, a.user_id, u.user_name, u.user_id
        FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b, ".USERS_TABLE." u
        WHERE a.image_active=1 AND a.cat_id = b.cat_id AND u.user_id = a.user_id
        ORDER BY a.image_downloads DESC
        LIMIT 1";

$row = $pics_db->query_firstrow($sql);
$image_id = $row['image_id'];
$user_name = $row['user_name'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<td align=\"center\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"><br>\n";
echo "<b>$image_name</b><br>\n";
echo "uploaded by <b>$user_name</b><br>\n";
echo "Top Downloads</td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits, a.user_id, u.user_name, u.user_id
        FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b, ".USERS_TABLE." u
        WHERE a.image_active=1 AND a.cat_id = b.cat_id AND u.user_id = a.user_id
        ORDER BY a.image_hits DESC
        LIMIT 1";

$row = $pics_db->query_firstrow($sql);
$image_id = $row['image_id'];
$user_name = $row['user_name'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<td align=\"center\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"><br>\n";
echo "<b>$image_name</b><br>\n";
echo "uploaded by <b>$user_name</b><br>\n";
echo "Top Hits</td>\n";

# -----------------------------------------------------------------------------------------------------------------------------------

echo "</tr></table>\n";

?>

I use this code to test and I have a error in line 12

$pics_db = new Db($db_host, $db_user, $db_password, $db_name);

Need put information about the database?

Thso works with the 1.7.6

Tanks and sorry my english

Title: Re: [Mod] Photo Of The Day
Post by: V@no on March 19, 2009, 02:10:50 PM
What error?

just in case check out this post and the next reply:
http://www.4homepages.de/forum/index.php?topic=3529.msg110432#msg110432
Title: Re: [Mod] Photo Of The Day
Post by: fermachado on March 19, 2009, 03:13:55 PM
What error?

just in case check out this post and the next reply:
http://www.4homepages.de/forum/index.php?topic=3529.msg110432#msg110432


Hi,

Thanks,

I have the photo of the day from the original code from SLL in my site and works.

But, the code of Balu is different no?
Title: Re: [Mod] Photo Of The Day
Post by: V@no on March 19, 2009, 03:55:19 PM
I guess it is different...
why did you use Balu's code?
Title: Re: [Mod] Photo Of The Day
Post by: fermachado on March 19, 2009, 06:44:33 PM
I want the Balu code just for test to see what is different.

I think the Balu code wok with the real 24 hours. :?
Title: Re: [Mod] Photo Of The Day
Post by: adamnorth on March 25, 2009, 10:13:39 PM
Hi,

I did all of the instructions as asked but on my page it keeps giving a 404 image not found. Looked around this topic for a solution, found 1 but did not fix it. I'm sure I did not make an error on replacing the required codes and uploading the potd file to the templates directory...anyone else having this problem?

Title: Re: [Mod] Photo Of The Day
Post by: V@no on March 26, 2009, 01:47:21 AM
Try use this modifications over the originals:
Re: [Mod] Photo Of The Day (http://www.4homepages.de/forum/index.php?topic=3529.msg132777#msg132777)
Title: Re: [Mod] Photo Of The Day
Post by: adamnorth on March 27, 2009, 10:30:38 PM
The first post on this forum for the download and demo of POTD mod, the links are dead. Any idea where I can find it elsewhere?
Title: Re: [Mod] Photo Of The Day
Post by: V@no on March 28, 2009, 06:30:44 AM
download and demo links work for me. as a backup the package also attached to the first post.
Title: Re: [Mod] Photo Of The Day
Post by: amboutwe on March 30, 2009, 02:13:25 AM
:D
SSL: Thank you for creating this wonderful addition.
V@no : Thank you for your additions.
:D

At first install, it didn't work but I used V@no's updates and it works wonderfully now.

 :idea: Now, I'm working on adding this to my non gallery pages to drive traffic to the gallery. Thanks again.
Title: Re: [Mod] Photo Of The Day
Post by: Sebas Bonito on July 14, 2009, 02:54:11 PM
Thx for this mod, but actually it is no "Photo of the day"  8O

In my imagination a 'photo of the DAY' would be

- a selection of the admin (who has chosen the best photos for each day), or the picture has

- the most hits, comments, downloads etc. (in your case they are the total hits, and not of the past 24h)

...or am I wrong?  :|
Title: Re: [Mod] Photo Of The Day
Post by: varoon on July 16, 2009, 11:11:19 AM
Thx for this mod, but actually it is no "Photo of the day"  8O

In my imagination a 'photo of the DAY' would be

- a selection of the admin (who has chosen the best photos for each day), or the picture has

- the most hits, comments, downloads etc. (in your case they are the total hits, and not of the past 24h)

...or am I wrong?  :|

ya ur right... but now a days many admin cannot update these small options regularly. so they have created it random.  :mrgreen:
Title: Re: [Mod] Photo Of The Day
Post by: Sebas Bonito on July 16, 2009, 02:07:06 PM
Maybe there is a possibility to "take a look" only of the past 24hours  :?:
Title: Re: [Mod] Photo Of The Day
Post by: daymos on September 29, 2009, 07:48:15 PM
Code: [Select]
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM 4images_images i, 4images_categories c LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND c.cat_id = i.cat_id ORDER BY i.image_comments DESC LIMIT 1
Unknown column 'i.user_id' in 'on clause'
How can I fix that? Please help me!
Regards,
Code: [Select]
 $sql = "SELECT DISTINCT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id



How to show TOP 3 images by 'rating'?
Title: Re: [Mod] Photo Of The Day
Post by: Rembrandt on September 29, 2009, 08:38:43 PM
Hi!
..
How to show TOP 3 images by 'rating'?

Code: [Select]
$sql = "SELECT DISTINCT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
           ORDER BY i.image_votes DESC
           LIMIT 3";

mfg Andi

[EDIT by V@no]
added ";
Title: Re: [Mod] Photo Of The Day
Post by: justintjacob on May 27, 2010, 02:31:31 PM
after installing picture of the day i got error

DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM 4images_images i, 4images_categories c LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND c.cat_id = i.cat_id ORDER BY i.image_votes DESC LIMIT 1
Unknown column 'i.user_id' in 'on clause'

and a "File not found"error message t the point of the image

Please Help Me
Title: Re: [Mod] Photo Of The Day
Post by: diehard on July 29, 2010, 10:43:57 AM
Hi all.
This is my sql query in a "photo of the day" by  postcards  sended since beginning of the day




Code: [Select]
$timestamp = strtotime(date("d-m-Y"));
$sql = "SELECT c.image_id, COUNT(c.image_id ) AS NumOccurrences, c.postcard_date, i.image_id,  i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date,  i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url,  i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes,  i.image_rating, i.image_hits, d.cat_name
FROM (".POSTCARDS_TABLE." AS c)
LEFT JOIN (".IMAGES_TABLE." AS i, ".CATEGORIES_TABLE." d) ON ( c.image_id = i.image_id )
WHERE (c.postcard_date > ".$timestamp.")
GROUP BY c.image_id
HAVING (COUNT( c.image_id ) >1)
ORDER BY NumOccurrences DESC
LIMIT 1";

Title: Re: [Mod] Photo Of The Day
Post by: zakaria666 on August 13, 2010, 06:05:17 PM
Hello,

This mod is great but i have noticed that when i refresh the page it will say "selected by votes' then if i rrefresh again it will say 'select by comment' or votes or hits, but some of them i have no done, so for example i have not put any comments on an comment but it will say selected by comments which this is not true, is there a way to tweak this so that correct information is shown for why the photo of the day is actually the photo of the day..

Thank u to anyone who help  me.
Title: Re: [Mod] Photo Of The Day
Post by: milanNN on January 09, 2011, 04:19:38 PM
Hi!
..
How to show TOP 3 images by 'rating'?

Code: [Select]
$sql = "SELECT DISTINCT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
           ORDER BY i.image_votes DESC
           LIMIT 3

mfg Andi
I've chaneged this code but i've got error:
Parse error: syntax error, unexpected '"' in C:\planesphotos.local\www\includes\functions.php on line 711

Title: Re: [Mod] Photo Of The Day
Post by: Rembrandt on January 09, 2011, 04:54:54 PM
....I've chaneged this code but i've got error:
.
I think they have deleted  ";
replace:
LIMIT 3 ";
 
Title: Re: [Mod] Photo Of The Day
Post by: milanNN on January 09, 2011, 05:54:58 PM
....I've chaneged this code but i've got error:
.
I think they have deleted  ";
replace:
LIMIT 3 ";
 
Thanks but i see one image only.
And i don't want to show photos selected by downloads.
How to do it?
Title: Re: [Mod] Photo Of The Day
Post by: SweD on October 18, 2011, 01:52:33 PM
Hi.
update my file.
Don't work site
Empty index page

Version 1.7.10


WORK!
Title: Re: [Mod] Photo Of The Day
Post by: whwsammler on December 16, 2011, 01:34:58 PM
Ich habe den MOD nach einigen keinen Schwierigkeiten eingebaut bekommen.
Mir fehlt nur noch eine Info zu meinem Glück. Welche Änderung muss ich vornehmen, damit die Überschrift "Bild des Tages" an der markierten Stelle des Anhangs erscheint?
Vielen Dank im Voraus

Gruß
Mathias
Title: Re: [Mod] Photo Of The Day
Post by: Rembrandt on December 16, 2011, 03:31:25 PM
Hi!
wenn du den code in der "includes/page_header.php" und "lang/main.php" eingebaut hast, sollte das funktionieren.

mfg Andi
Title: Re: [Mod] Photo Of The Day
Post by: whwsammler on December 16, 2011, 06:38:44 PM
Sorry ich bin da ein absoluter noob. Welchen Code soll ich denn einbauen?
Title: Re: [Mod] Photo Of The Day
Post by: Rembrandt on December 16, 2011, 06:40:57 PM
.. Welchen Code soll ich denn einbauen?

na den aus den mod hier, eben ob du die änderungen in der "includes/page_header.php" und "lang/main.php" vorgenommen hast.
Title: Re: [Mod] Photo Of The Day
Post by: whwsammler on December 16, 2011, 07:09:54 PM
Habe alles noch mal kontrolliert. Code ist gem. Installationsanweisung eingebaut. Scheint ja auch funktionieren, bis auf die fehlende Überschrift "Foto des Tages"
Title: Re: [Mod] Photo Of The Day
Post by: Rembrandt on December 16, 2011, 07:15:07 PM
hm.. gibts eigentlich nicht mit
Code: [Select]
{lang_potd_title}sollte dir der Titel in der html Datei angezeigt werden
Title: Re: [Mod] Photo Of The Day
Post by: whwsammler on December 16, 2011, 08:18:46 PM
Hmmmm never mind my previous suggestion...

The mod was built on 4images v1.7 since then the template engine was changed, and now the registering template tags must be done before parsing the template - and that what causing the problem.

What you need to do is replace in includes/page_header.php:
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

$potd_image = (defined("SHOW_POTD_IMAGE") && SHOW_POTD_IMAGE == 0) ? "" : get_potd_image();
$site_template->register_vars("potd_image", $potd_image);
$site_template->register_vars(array("lang_potd_title" => $lang['potd_title']));
$site_template->register_vars(array("lang_potd_type" => $lang['potd_type_'.ereg_replace ("i.image_", "", $select_mode)]));
unset($potd_image);

//--- End Photo Of The Day ----------------------------

With this:
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

$site_template->register_vars("potd_image", (defined("SHOW_POTD_IMAGE") && SHOW_POTD_IMAGE == 0) ? "" : get_potd_image());

//--- End Photo Of The Day ----------------------------



Then in includes/functions.php replace
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

function get_potd_image() {
    global $site_db, $site_template, $select_mode;

$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");

switch (POTD_SELECT_MODE) {
case "rating" : $select_mode = "i.image_rating"; break;
case "votes" : $select_mode = "i.image_votes"; break;
case "comments" : $select_mode = "i.image_comments"; break;
case "downloads" : $select_mode = "i.image_downloads"; break;
case "hits" : $select_mode = "i.image_hits"; break;
case "random" : $selection = array('rating', 'votes', 'hits', 'comments', 'downloads');
mt_srand((double) microtime() * 1000000);
$select_mode = 'i.image_'.$selection[mt_rand(0, (count($selection)-1))];
break;
}

    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            ORDER BY $select_mode DESC LIMIT 1";

  $potd_image = $site_db->query_firstrow($sql);
$site_db->free_result();
$template = 'potd_image';
show_image($potd_image, "", 1);
$potd_image = $site_template->parse_template($template);
return $potd_image;
}

//-----------------------------------------------------

With this:
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

function get_potd_image($selection = false)
{
  global $site_db, $site_template, $lang;

  if ($selection === false)
    $selection = POTD_SELECT_MODE;

  $selection = strtolower($selection);
  $selection_array = array('rating', 'votes', 'hits', 'comments', 'downloads');
  if ($selection != "random" && !in_array($selection, $selection_array))
    $selection = "rating";

  switch ($selection)
  {
    default       : $select_mode = "i.image_".$selection; break;
    case "random" : mt_srand((double) microtime() * 1000000);
                    $selection = $selection_array[mt_rand(0, (count($selection_array)-1))];
                    $select_mode = 'i.image_'.$selection;
             break;
  }

  $cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");
  $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
          FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
          WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
          ORDER BY $select_mode DESC LIMIT 1";
  if (!($potd_image = $site_db->query_firstrow($sql)))
    return;

  show_image($potd_image, "", 1);
  $site_template->register_vars(array(
    "lang_potd_title" => $lang['potd_title'],
    "lang_potd_type" => $lang['potd_type_'.$selection],
  ));
  $potd_image = $site_template->parse_template('potd_image');
  return $potd_image;
}

//--- End Photo Of The Day ----------------------------



Wer lesen kann ist klar im Vorteil. Habe den verkehrten Code eingebaut. Habe es nun gem. o. a Eintrag geändert und was soll ich sagen es funzt
Nun ist der Text Bild des Tages allerdings in der Mitte. Wäre schöner wenn der Text aber rechtsbündig stehen würde. Was ist denn nun zu ändern?
Title: Re: [Mod] Photo Of The Day
Post by: Rembrandt on December 16, 2011, 09:04:59 PM
suche in der podt_image.html, "center" und ersetze es mit "left".

mfg Andi
Title: Re: [Mod] Photo Of The Day
Post by: whwsammler on December 17, 2011, 08:16:40 AM
Alles bestens. Vielen Dank!  :P

Gruß
Mathias