4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: SLL on January 11, 2003, 02:13:24 AM
-
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)
-
Thanks SLL
-
Will this MOD work if there is already an interation between phpBB and 4images?
:D
-
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:
-
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~
-
When u edited /includes/functions.php file, u probably forgot put } at the end of script u added.
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;
}
;)
-
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...
-
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
-
I sent you a Private Message, did u get it???
If not, my email is Nate_Wheeler@MSN.com
-
make sure u dont have ANYTHING (spaces, returnsigns...so on) after " ?> " at the end of php files.
-
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
-
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!
-
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...
-
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~
-
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.
-
Hi all
Is there any way of displaying the full size image as photo of the day ?
Thanks
Steve
-
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
-
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
-
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.
-
Thanks SSL.
How do you make it linkable as well ?
Thanks
Steve
-
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???
-
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
-
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.
-
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
-
This query has nothing to do with this MOD. Check functions.php against MOD text, I believe you missing something.
-
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
-
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.
-
@ all danke
Ich hatte eine Seite falsch benannt, nur 2 Buchstaben vertausch, wieeee doooof aber auch.
lg
Gabi
-
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
-
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!
-
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: case "by_hits" : $select_mode = "i.image_hits"; $select_mode2 = ", i.image_name ASC"; break;
and in /includes/constants.php change to this: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? ;)
-
Thanks for this fast answer 8O
-
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.
-
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:if ($user_info['user_level'] != GUEST) {
And at the end of the code add }
So, it would looks like this: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);
}
-
Thanks! Great mod!
-
is it possible to make the photo of the day first choice the number of favorites (lightbox) ?
-
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?
-
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
-
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!
-
yeah... why not?
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...
-
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.
-
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
-
yeah... why not? 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 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.
-
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:
WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
with this: 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'])."
-
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
-
parent and sub categories uses same template, so there is no way u can separate them, without some changes in .php files.
-
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?
-
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
-
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
-
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!!
-
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: WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
Replace with: 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
-
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
-
I'd just edit template :roll:
-
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:
-
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
$lang['potd_type_rating'] = "Selected by rating... this is the best pi c at my site ever...bla-bla-bla...";
-
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
-
ok, then, u can do this way:
change the code u added into /includes/functions.php to this://-----------------------------------------------------
//--- 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:
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"msg" => $msg,
replace with:
$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:
{if potd_msg}
---------Your html table, any code---------
{potd_msg}
---------Whatever u want----------
{endif potd_msg}
-
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
-
or just show the message as long as she's selected as potd?
yes
-
Did i miss it?
I need to know how i can show the POTD in an external php page.
Thanks
-
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
-
and how can i combine it SLL?
-
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:
-
V@no this is a MOD Request!
-
you can combine it with "radom image" mod for this
http://www.4homepages.de/forum/viewtopic.php?t=1020
exactly!
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:<?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. *
* *
*************************************************************************/
// 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)) ? 1 : 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 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 (u.user_id = i.user_id)
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($sql);
$site_db->free_result();
$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 "<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<br>\n";
?>
aslo, I'd suggest change from SLL original script switch (POTD_SELECT_MODE) { ... }to this: 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, ORDER BY $select_mode DESC
to this: 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
-
aslo, I'd suggest change from SLL original script...
Fixed... Thanks! :wink:
-
Additional languages for above mode:
#
#-----[ 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'] = "Фотография дня";
$lang['potd_type_rating'] = "Выбрано по рейтингу";
$lang['potd_type_votes'] = "Выбрано по голосованиям";
$lang['potd_type_comments'] = "Выбрано по комментариям";
$lang['potd_type_downloads'] = "Выбрано по загрузкам";
Can you change to english?
-
how to change the photo in the center?
i mean "phopt of the day".
http://utenti.lycos.it/kueou/4images/index.php
-
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.
-
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
-
Can you change to english?
no, i can't... i don't speak english :cry:
-
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.
-
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 :)
-
but is this additional field hard to make?
hard enough... this requires db modification, but i'd like to keep this mod simple
-
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
-
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.
-
Ok, thanks again.
I have to rename it to "Most Voted Photo" or something like that. :wink:
-
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
-
Mebbernind!
I think I have it figured out with the help of a couple of friends....
<?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)) ? 1 : 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(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";
?>
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:
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:
-
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?
-
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"??
-
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
-
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
-
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
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:
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.
-
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?
-
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.
-
I was wondering, if it would be possible to exclude pics from one or two specific categories from being displayed in the POTD mod.
-
...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!
-
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'.
-
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:WHERE ..... AND c.cat_id != 2 ..... AND c.cat_id > 4
-
Am I guessing right, that
c.cat_id != 2
would exclude category 2 and c.cat_id > 4
would exclude categories 1, 2 and 3?
-
yes, you're right.
-
#############################################################################################
## 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
-
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
-
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?
-
Im interested in this too,
SLL, do it for a fellow russian! :D
-
<?php
define('ROOT_PATH', './4images/');
define('SITE_URL', 'http://www.mygallery.com/');
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'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
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
-
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
-
is it possible to insert this php i a html site on a other server?
no
btw. I got this error:
original POTD mod has to be installed first.
-
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?
-
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:
<?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";
?>
-
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
-
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?
-
which line I have to delete?
$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";
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.
-
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
-
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...
-
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?
-
<?php
define('ROOT_PATH', './4images/');
define('SITE_URL', 'http://faces.dalnet.ru/');
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=\"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($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 "<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($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 "<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($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 "<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($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 "<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($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 "<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";
?>
-
FANTASTIC!!!!
One last question:
how to center this table and columns
-
how to center this table and columns
add align=\"center\" in each <td> tag
-
many many thx - the smallest problem are the greatest :lol:
btw. is it possible to add "the uploader" under the pics?
-
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:
$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:
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:
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 include_once(ROOT_PATH.'includes/constants.php');
next two line are not necessery, u could use CATEGORIES_TABLE and USERS_TABLE ;)
-
Im gonna set this up myself today.
Wow, your amazing skills put me to shame. *bows*
Thanksa lot guys!
-
: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?
-
Absolut GREAT
here the full mod - thx to sll and v@no!!!
<?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";
?>
-
@SLL:
since u have 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.
-
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...
-
New version posted. Now you can set random selection mode (by votes, hits, comments, etc.)
download: http://faces.dalnet.ru/files.php?l=english
-
New version posted. Now you can set random selection mode (by votes, hits, comments, etc.)
Dear SLL.
Where you posted ?
-
Where you posted ?
First post in this thread. Check the history log.
-
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?
-
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
-
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
-
it can be configured to choose from most hits, votes, downloads,ranking, comments.
-
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
-
:?:
:?
8) vincent
-
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
-
I get this 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 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?
-
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:
// 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');
-
Wo und was muß man etwas ändern wenn mehrere potd Bilder angezeigt werden sollen ?
-
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?
-
if you want to show the potd for the current month:
open /includes/functions.php
find in the potd mode:
WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
replace it with:
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")))."
-
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.
-
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 :(
-
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 :(
-
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:
<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.
-
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:
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.
-
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:
<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 :(
-
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.
-
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.
-
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:
<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
...="4" />Photo of The Day</td...
But I cant set
lang_potd_type}<br />Image by Hits<br /></
because i set in constance.php
POTD_SELECT_MODE', 'random');
So.. if I set 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 :(
-
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
-
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:
<tr><td align="center" class="row1">{lang_potd_type}<br />Image by Hits<br /></td></tr>
Replace with:
<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.
-
Hi folks!
I installed this mod and got this 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 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...
-
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?
-
I also get a Bad SQL Query
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
-
thanks for this MOD I'm using it
-
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/
-
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?
-
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?
-
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?
-
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.
<strong>{lang_potd_title}</strong><br /><br />
<div align="center"><span class="thumb">{thumbnail}</span><br />
{lang_potd_type}</div>
-
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 "
//-----------------------------------------------------
//--- 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 ----------------------------
-
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. // 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:// The choices to select Photo Of The Day are: 'votes', 'rating', 'comments', 'downloads', 'hits' or 'random'
-
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.
-
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.):
<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 <br />{thumbnail}<br /><b>{image_name}</b><br />
tell me if that works for you :)
-
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
-
Jusy installed this mod but it dosen't say "Photo of the Day" above the photo, please can some one help.
-
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
-
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:
-
Any way to change it from photo of the day to photo of the week?
thanks
-
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?
-
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... :|
-
:mrgreen: oops... my mistake...
problem solved...
-
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
-
Can this Mod be only for a especific categories ?
-
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,
-
I think the script don't works with version 1.7.4
-
The mod runs without problems in the new version, too. WIth random sort and so on.
-
After installing this mod these errors has occurred
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
-
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.
-
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:
$download_token = array();
I only have a few mods added so I couldn't tell you anymore then that.
-
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:
$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.
-
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.
-
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
-
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.
-
Mysite not a title Photo of the day under random images
Demo: http://emtoi.org/gallery/index.php
Help me
-
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
-
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!
-
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.
-
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
-
hallo!
ich glaube, du suchst dann lieber hier im forum nach "mini top"
-
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
-
Mebbernind!
I think I have it figured out with the help of a couple of friends....
<?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)) ? 1 : 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(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";
?>
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:
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:
//-----------------------------------------------------
//--- 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:
$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?
-
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.
-
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?!
-
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
-
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?
-
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{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
{potd_image}
ersetze durch
<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>
-
He, das ist ja kaum zu glauben! So eine schnelle Antwort und es klappt auch noch wunderbar! :D
Ich danke dir vielmals!!!!!!
Gruß.
-
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!
-
Mebbernind!
I think I have it figured out with the help of a couple of friends....
<?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)) ? 1 : 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(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";
?>
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:
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:
//-----------------------------------------------------
//--- 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:
$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.. ???
-
Isnt it anyone here that can make this mod work?? the way I have descibed over here??
Pleeease.. It would really make my day :)
-
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
//-----------------------------------------------------
//--- 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
//-----------------------------------------------------
//--- 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
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
-
hi
thanks problem is solved
-
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.
-
hi
Photo of the day is selected through visits to the photo is selected automatically.
-
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.
-
ı want select photo of the day in admin panel.can we do?
-
25.01.2009 fix
for 1.7.6
language turkish
read kurulum.doc
-
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.
-
my potd_title and potd_type also not showing...
please help...
http://batamphotoclub.co.cc
-
You either didn't do properly steps with modification of
includes/page_header.php (doubtful)
and/or
lang/<your language>/main.php (most likely)
-
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..
$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
$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.
-
Ok, since you are not using "standard" template you must add code in page_header.php above first parse_template
-
I see several parse_template in the file..
this is my full page_header.
in which line should I insert the POTD codes..?
<?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_id, null)) {
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_id, serialize($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) ? 0 : 1,
"user_loggedout" => ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) ? 1 : 0,
"is_admin" => ($user_info['user_level'] == ADMIN) ? 1 : 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 © 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_id, 1);
} 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(0, 1);
$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_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_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) ? 1 : 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!
-
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 ----------------------------
-
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:
case "default": $select_mode = "i.image_".POTD_SELECT_MODE; break;
-
Sorry about that, I've updated the code above.
-
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!
-
Absolut GREAT
here the full mod - thx to sll and v@no!!!
<?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
-
What error?
just in case check out this post and the next reply:
http://www.4homepages.de/forum/index.php?topic=3529.msg110432#msg110432
-
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?
-
I guess it is different...
why did you use Balu's code?
-
I want the Balu code just for test to see what is different.
I think the Balu code wok with the real 24 hours. :?
-
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?
-
Try use this modifications over the originals:
Re: [Mod] Photo Of The Day (http://www.4homepages.de/forum/index.php?topic=3529.msg132777#msg132777)
-
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?
-
download and demo links work for me. as a backup the package also attached to the first post.
-
: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.
-
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? :|
-
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:
-
Maybe there is a possibility to "take a look" only of the past 24hours :?:
-
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,
$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'?
-
Hi!
..
How to show TOP 3 images by 'rating'?
$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 ";
-
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
-
Hi all.
This is my sql query in a "photo of the day" by postcards sended since beginning of the day
$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";
-
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.
-
Hi!
..
How to show TOP 3 images by 'rating'?
$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
-
....I've chaneged this code but i've got error:
.
I think they have deleted ";
replace:
LIMIT 3 ";
-
....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?
-
Hi.
update my file.
Don't work site
Empty index page
Version 1.7.10
WORK!
-
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
-
Hi!
wenn du den code in der "includes/page_header.php" und "lang/main.php" eingebaut hast, sollte das funktionieren.
mfg Andi
-
Sorry ich bin da ein absoluter noob. Welchen Code soll ich denn einbauen?
-
.. 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.
-
Habe alles noch mal kontrolliert. Code ist gem. Installationsanweisung eingebaut. Scheint ja auch funktionieren, bis auf die fehlende Überschrift "Foto des Tages"
-
hm.. gibts eigentlich nicht mit
{lang_potd_title}
sollte dir der Titel in der html Datei angezeigt werden
-
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?
-
suche in der podt_image.html, "center" und ersetze es mit "left".
mfg Andi
-
Alles bestens. Vielen Dank! :P
Gruß
Mathias