• [Mod] Photo Of The Day 4 0 5 1
Currently:  

Author Topic: [Mod] Photo Of The Day  (Read 269907 times)

0 Members and 1 Guest are viewing this topic.

Offline shadowhunter

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Fotogalerie & Fotocommunity scluzern.com
Re: [Mod] Photo Of The Day
« Reply #180 on: February 03, 2007, 11:25:23 PM »
Hallo
Wie kann ich auf der Hauptseite der Galerie dieses Script mit 4 verschiedenen Kriterien (Most Viewed, Rated, Voted, Commented) horizontal (wie "Neue Bilder") einbinden? Bis anhing konnte man ja nur ein Kriterum auswählen... Ich hoffe, dass mir jemand weiterhelfen kann.
Wäre sehr dankbar für Lösungen!
mfg shadow hunter

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [Mod] Photo Of The Day
« Reply #181 on: February 04, 2007, 09:38:56 AM »
hallo!
ich glaube, du suchst dann lieber hier im forum nach "mini top"

Offline darvid

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • KNOWTEBOOK.COM - Community for webdeveloper
Re: [Mod] Photo Of The Day
« Reply #182 on: April 05, 2007, 09:16:45 PM »
this mod works definetly with 4images 1.7.4 !! though, there is still one bug which causes in the newer versions problems with the mysql queries, wich were mentioned before. here is the work-around i found (http://www.4homepages.de/forum/index.php?topic=5874.msg74179#msg74179), because the author of the script hasnt done this update in all of his scripts yet.


OPEN
includes/functions.php

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

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

THATS IT!! - SAVE AND UPDATE FILE ON SERVER
« Last Edit: May 10, 2007, 05:13:44 PM by c-bass »
/* KNOWTEBOOK - BoostYourself community for webdeveloper
/* http://www.knowtebook.com

Integration von Wordpress Blog, PHPBB Forum und 4Images Bildergalerie:
http://www.sebastianscheuer.de/aktuell/integration-von-wordpress-blog-phpbb-forum-und-4images-bildergallerie/
DEMO: http://www.pilotenbilder.de/

Offline darvid

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • KNOWTEBOOK.COM - Community for webdeveloper
Re: Mebbernind!
« Reply #183 on: July 05, 2007, 10:11:53 PM »
Mebbernind!

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

Code: [Select]
<?php

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

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

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

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

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

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

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

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

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

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


Hi,

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

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

Replace the code in the functions.php with:

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

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

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

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

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

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

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

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

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

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


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


---EDIT---

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

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

any idea?
« Last Edit: July 05, 2007, 10:37:39 PM by c-bass »
/* KNOWTEBOOK - BoostYourself community for webdeveloper
/* http://www.knowtebook.com

Integration von Wordpress Blog, PHPBB Forum und 4Images Bildergalerie:
http://www.sebastianscheuer.de/aktuell/integration-von-wordpress-blog-phpbb-forum-und-4images-bildergallerie/
DEMO: http://www.pilotenbilder.de/

Offline Anderson

  • Pre-Newbie
  • Posts: 5
    • View Profile
    • Album digital :: Anderson Cardoso Silva
Re: [Mod] Photo Of The Day
« Reply #184 on: July 20, 2007, 04:02:03 PM »
I did everything, but it is showing only the image of the day and its name, the title and the type is not shown in the page...

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

Any ideas?

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

Please help.

Offline Anderson

  • Pre-Newbie
  • Posts: 5
    • View Profile
    • Album digital :: Anderson Cardoso Silva
Re: [Mod] Photo Of The Day
« Reply #185 on: July 23, 2007, 05:14:27 AM »
I did a workaround to solve my problem... I had just included the source code of the template (potd_image.html) in the place where I would put {potd_image} and i work out.

But it didn't seem to be a Photo of the Day... as I have selected by rate and it shows a picture without any rate as the Photo of the Day... funny, isn't it?!

Offline Crazy_Boys

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: [Mod] Photo Of The Day
« Reply #186 on: September 23, 2007, 08:48:56 PM »
Ich habe das Mod eingebaut, Leider wird bei mir dies infos nicht angezeigt.Ich habe alles perfeckt eingebaut, ich benutze 1.74

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

Mfg

skiemor

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

Offline Icemann71

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


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

home.html
find
Code: [Select]
{potd_image}ersetze durch
Code: [Select]
<table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20">
<p align="center"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_potd_title}<br>{lang_potd_type}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">
    <br />
                       {potd_image}
<br />
                        <br />
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
Have a nice Day ;-)

skiemor

  • Guest
Re: [Mod] Photo Of The Day
« Reply #189 on: September 27, 2007, 10:27:54 PM »
He, das ist ja kaum zu glauben! So eine schnelle Antwort und es klappt auch noch wunderbar!  :D
Ich danke dir vielmals!!!!!!

Gruß.

Offline matosale

  • Full Member
  • ***
  • Posts: 160
    • View Profile
    • My Way of Life
Re: [Mod] Photo Of The Day
« Reply #190 on: October 11, 2007, 02:38:22 PM »
Hi!

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



Thanks in advance!
Alejandro Matos
   Lima - Perú

   Linz - Austria
   Helsinki - Finland
   Seville - Spain



Offline cloe

  • Full Member
  • ***
  • Posts: 120
    • View Profile
Re: Mebbernind!
« Reply #191 on: January 23, 2008, 03:23:44 AM »
Mebbernind!

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

Code: [Select]
<?php

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

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

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

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

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

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

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

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

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

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


Hi,

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

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

Replace the code in the functions.php with:

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

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

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

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

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

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

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

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

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

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


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


---EDIT---

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

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

any idea?

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

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

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

If it is so... I wolud really get this to work... I really hope that someone can help me here.. ???
Peace And Luv :)

--Cecilie--

http://www.cloevvold-photo.com

Offline cloe

  • Full Member
  • ***
  • Posts: 120
    • View Profile
Re: [Mod] Photo Of The Day
« Reply #192 on: January 23, 2008, 10:01:23 PM »
Isnt it anyone here that can make this mod work?? the way I have descibed over here??

Pleeease.. It would really make my day :)
Peace And Luv :)

--Cecilie--

http://www.cloevvold-photo.com

Offline masterred

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
Re: [Mod] Photo Of The Day
« Reply #193 on: January 29, 2008, 05:27:07 PM »
this mod works definetly with 4images 1.7.4 !! though, there is still one bug which causes in the newer versions problems with the mysql queries, wich were mentioned before. here is the work-around i found (http://www.4homepages.de/forum/index.php?topic=5874.msg74179#msg74179), because the author of the script hasnt done this update in all of his scripts yet.


OPEN
includes/functions.php

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

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

THATS IT!! - SAVE AND UPDATE FILE ON SERVER


i have this error

this is the original script in functions.php

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

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

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

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

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

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

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

modify

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

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

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

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

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

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

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

and error with modify

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

i need you help thanks




Apache/2.2.21 (Win32)
PHP/5.3.5
Mysql Version: 5.5.19
4images Version: 1.7.?



Offline masterred

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
Re: [Mod] Photo Of The Day
« Reply #194 on: January 29, 2008, 07:21:00 PM »
hi

thanks problem is solved
Apache/2.2.21 (Win32)
PHP/5.3.5
Mysql Version: 5.5.19
4images Version: 1.7.?