CyberiaPC.com Community Forums Main Page
RSS Feeds: Late(st) News | Zenith Picture Gallery | Most Recent Community Topics | Tips, Tricks and Other Useful Stuff

Welcome Guest ( Log In | Register )

Reply to this topicStart new topic
> News images in folders
Equinoxe5
post Jan 27 2008, 05:46 PM
Post #1


New Member
*

Group: Members
Posts: 10
Joined: 22-January 08
From: France
Member No.: 9,485

Nothing Selected




Here is a small Novelty to see if an image is new or not in each category. If the photo is new, a small image is displayed next to the sticker. The number of days for a new image is customizable in admin cp.

For this, you must modify some files (Save your original file for more precautions).

1 - in file f_search.php

add under
CODE
if($row['d'] != null)   $row['d'] = strftime($config['short_date_format'],$row_t['t'] + $config['timezone_offset']);

this line
CODE
$row['z'] = strftime($config['mysql_date_format'],$row_t['t'] + $config['timezone_offset']);


2 - in file f_global.php

after
//--------------------------------------------
// showEntry()
//--------------------------------------------
function showEntry($lang, $row, $config, $show_what) {
$status = false;

add these 4 lines

CODE
$date_ajout = strtotime($row['z']);             // Date ajout de l'image -> Date adding image
    $date_jour = strtotime(date('Y-m-d'));          // Date du jour -> Date of the day
    $new_p = "{$config['new_image']}";              // Paramètre nb jours dans admin cp -> Number of days for new image in admin cp
                $diff = (($date_jour-$date_ajout)/86400);       // Différence entre les 2 dates -> Difference Between 2 dates


and replace

CODE
if(in_array("title",$show_what))   echo "<strong>{$row['title']}</strong><br />";
    if(in_array("description",$show_what))   echo "{$row['description']}<br />";
    if(in_array("size",$show_what)) echo "{$lang['file_size']} {$row['fsize']}Kb<br />";
    if(in_array("category",$show_what))   echo "{$lang['category']} {$row['category']}<br />";
    if(in_array("rating",$show_what))   echo "{$lang['rating']} {$row['r']}<br />";
    if(in_array("comment_body",$show_what)) {
    $row['comment_body'] = str_replace("<br >","<br />", $row['comment_body']); //support line breaks (new in v0.9.4 DEV)
    echo "<strong><span class='tiny_text'>{$row['comment_body']}</span></strong><br />";
    }


with

CODE
if(in_array("title",$show_what))   echo "<strong>{$row['title']}</strong><br />";
    if(in_array("description",$show_what))   echo "{$row['description']}<br />";
                if ($diff < $new_p)
                {
                if(in_array("date",$show_what)) echo "{$lang['last_updated']} {$row['d']} <img src='images/puce.jpg' alt='{$lang['image_new']}'> <br />";
    }else{
    if(in_array("date",$show_what)) echo "{$lang['last_updated']} {$row['d']} <br />";
    }
    if(in_array("size",$show_what)) echo "{$lang['file_size']} {$row['fsize']}Kb<br />";
    if(in_array("category",$show_what))   echo "{$lang['category']} {$row['category']}<br />";
    if(in_array("rating",$show_what))   echo "{$lang['rating']} {$row['r']}<br />";
    if(in_array("comment_body",$show_what)) {
    $row['comment_body'] = str_replace("<br >","<br />", $row['comment_body']); //support line breaks (new in v0.9.4 DEV)
    echo "<strong><span class='tiny_text'>{$row['comment_body']}</span></strong><br />";
    }


3 - in file f_admin.php

after

CODE
$set_config['long_date_format'] = charsEscaperAdmin($_POST['long_date_format']);


add these two lines

CODE
$set_config['mysql_date_format'] = charsEscaperAdmin($_POST['mysql_date_format']);
    $set_config['new_image'] = charsEscaperAdmin($_POST['new_image']);


and after

CODE
'$config[\'long_date_format\']' . " = \"{$set_config['long_date_format']}\";\n" .


add the two lines

CODE
'$config[\'mysql_date_format\']' . " = \"{$set_config['mysql_date_format']}\";\n" .
    '$config[\'new_image\']' . " = \"{$set_config['new_image']}\";\n" .


4 - In your language file (For me it's french.php) add these three lines

CODE
'image_new'                                             => "Nouvelle image",
                'new_image'                                             => "Délai d'une image considérée nouvelle",
                'description_new_image'                                 => "Nombre de jours durant lesquels une image est considérée comme nouvelle avec affichage d'un petit logo sous la vignette",


For english.php, Google translate this :-)

CODE
'image_new'                                             => "New image",
                'new_image'                                             => "Time considered a new image",
                'description_new_image'                                 => "Number of days during which an image is viewed as a new display with a small logo underneath the sticker",


5 - In admincp.php

At the end of this line

CODE
$fields = array("{$_POST['perpage']}","{$_POST['lastadded_perpage']}","{$_POST['random_perpage']}","{$_POST['max_filesize']}","{$_POST['max_pic_width']}", "{$_POST['max_pic_height']}","{$_POST['jpeg_quality']}","{$_POST['thumb_width']}","{$_POST['thumb_height']}","{$_POST['thumbs_perrow']}","{$_POST['script_timeout']}"


add

CODE
,"{$_POST['new_image']}"


6 - In admincp file

after
CODE
<tr><td align='left' class='white_cell' width='60%'>{$lang['script_timeout']}<br /><span class='tiny_text'>{$lang['description_script_timeout']}</span></td><td class='white_cell' width='40%'><input value='"; if(isset($config['script_timeout'])) echo "{$config['script_timeout']}"; else echo "30";  echo "' type='text' name='script_timeout' maxlength='4' class='spoiltTextBox'></td></tr>


add
CODE
<tr><td align='left' class='white_cell' width='60%'>{$lang['new_image']}<br /><span class='tiny_text'>{$lang['description_new_image']}</span></td><td class='white_cell' width='40%'><input value='"; if(isset($config['new_image'])) echo "{$config['new_image']}"; else echo "10";  echo "' type='text' name='new_image' maxlength='4' class='spoiltTextBox'></td></tr>


after

CODE
<input type='hidden' name='table_prefix' value='{$config['table_prefix']}'>


add
CODE
<input type='hidden' name='mysql_date_format' value='%Y-%m-%d'>


Finaly: Create a new forler under root gallery named images with a small image named for exemple new.jpg

Enjoy

This post has been edited by Equinoxe5: Jan 28 2008, 07:26 PM
Go to the top of the page
 
+Quote Post
Dennis Evertse
post Feb 12 2008, 08:31 PM
Post #2


New Member
*

Group: Members
Posts: 39
Joined: 3-November 07
Member No.: 9,377

Netherlands




Is it possible to change the number of day's to next update??

I don't update an a regular bases, there for I Cant use an fixed number of day's, so it would be great if the images in the lasted update automatically get a "new" added until newer images are added.

Hope I'm not asking any difficult questions blushing.gif

Thanks
Go to the top of the page
 
+Quote Post
Dennis Evertse
post Feb 17 2008, 03:18 PM
Post #3


New Member
*

Group: Members
Posts: 39
Joined: 3-November 07
Member No.: 9,377

Netherlands




Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in ....../functions/f_global.php on line 202

line 202 --->
CODE
$date_ajout = strtotime($row['z']); // Date ajout de l'image -> Date adding image


blushing.gif

This post has been edited by Dennis Evertse: Feb 17 2008, 03:38 PM
Go to the top of the page
 
+Quote Post
Equinoxe5
post Feb 17 2008, 05:19 PM
Post #4


New Member
*

Group: Members
Posts: 10
Joined: 22-January 08
From: France
Member No.: 9,485

Nothing Selected




QUOTE(Dennis Evertse @ Feb 17 2008, 04:18 PM) *
Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in ....../functions/f_global.php on line 202

line 202 --->
CODE
$date_ajout = strtotime($row['z']); // Date ajout de l'image -> Date adding image


blushing.gif


Are you sure you don't forget all modifications ? because i have not that error, and your line 202 is for me line 213...
What is your version of ZPG ? For me, it's 0.94

Go to the top of the page
 
+Quote Post
Dennis Evertse
post Feb 17 2008, 06:30 PM
Post #5


New Member
*

Group: Members
Posts: 39
Joined: 3-November 07
Member No.: 9,377

Netherlands




Yes i'm sure, if checked and dubble checkt everything. Mayby you could mail me your F_global file blushing.gif

Version 0.94

Many Thanks thumbsup.gif

EDIT:

1 even used the original file, and modded everything:

Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in /home/dennisev/public_html/fotos/functions/f_global.php on line 212

I can;t get it... pinch.gif pinch.gif

Edit 2:

FOUND IT!!!

My F_search wasn't uploaded blink.gif , very strange....

This post has been edited by Dennis Evertse: Feb 17 2008, 07:07 PM
Go to the top of the page
 
+Quote Post
Dennis Evertse
post Apr 15 2008, 05:55 PM
Post #6


New Member
*

Group: Members
Posts: 39
Joined: 3-November 07
Member No.: 9,377

Netherlands




Is there a way to show all the pictures with the "new" tag on an seperate page?
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 19th May 2013 - 11:07 AM