J
JR Polidario
Guest
THIS IS THE PART OF THE SCRIPT WHICH I BELIEVE IS ESSENTIAL. This is not a script of mine or someone else I know. Please help me, I wanted to display images in my homepage, however they should be sorted by date. Any hints and ideas would much be appreciated. And please highlight changes if any. Thank you!
<?php
/*
Author: ricocheting.com
Creation Date: 5/11/2004
Last Update: 1/13/2008
Current Version: 1.2.1
Copyright 2004 ricocheting.com
*/
/*
This script is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// max image width or height allowed for thumbnail
$config['size'] = 400;
// jpeg thumbnail image quality
$config['imagequality'] = 70;
// rows of images per page
$config['rows'] = 10;
// columns of images per page
$config['cols'] = 1;
// max page numbers to show at once (so if you have 100 pages, it won't show links to all 100 at once)
$config['maxShow'] = 10;
// folder where full size images are stored (include trailing slash)
$config['fulls'] = "images/";
// folder where thumbnails are to be created (include trailing slash)
$config['thumbs'] = "thumbs/";
#-#############################################
# desc: prints out html for the table and the images found in directory
function PrintThumbs(){
global $config;
// full directory error check
if (!file_exists($config['fulls'])) {
Oops("Fullsize image directory <b>$config[fulls]</b> does not exist.");
}
// thumb directory error check
if (!file_exists($config['thumbs'])) {
if (!@mkdir($config['thumbs'], 0755)) {
Oops("Thumbnail image directory <b>$config[thumbs]</b> does not exist and can not be created. Check directory write permissions.");
}
}
// get the list of all the fullsize images
$imagelist = GetFileList($config['fulls']);
// number of and which images on current page
$config['start'] = ($config['page']*$config['cols']*$config['rows']);
$config['max'] = ( ($config['page']*$config['cols']*$config['rows']) + ($config['cols']*$config['rows']) );
if($config['max'] > count($imagelist)){$config['max']=count($imagelist);}
if($config['start'] > count($imagelist)){$config['start']=0;}
// start table
echo '<table border="0" cellpadding="0" cellspacing="0" align="center" class="gallery">';
echo "<tr>\n<td colspan=\"$config[cols]\" class=\"entries\">";
// "showing results"
if ($config['max'] == "0"){echo "Showing results <b>0 - 0</b> of <b>0</b></td></tr>\n";}
else{echo "Showing results <b>".($config['start']+1)." - $config[max]</b> of <b>".count($imagelist)."</b> entries</td>\n</tr>\n\n";}
$column_counter = 1;
// start row
echo "<tr>\n";
// for the images on the page
for($i=$config['start']; $i<$config['max']; $i++){
$thumb_image = $config['thumbs'].$imagelist[$i];
$thumb_exists = file_exists($thumb_image);
// create thumb if not exist
if(!$thumb_exists){
set_time_limit(30);
if(!($thumb_exists = ResizeImageUsingGD("$config[fulls]$imagelist[$i]", $thumb_image, $config['size']))){
Oops("Creating Thumbnail image of <strong>$config[fulls]$imagelist[$i]</strong> failed. Possible directory write permission errors.");
}
}
<?php
/*
Author: ricocheting.com
Creation Date: 5/11/2004
Last Update: 1/13/2008
Current Version: 1.2.1
Copyright 2004 ricocheting.com
*/
/*
This script is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// max image width or height allowed for thumbnail
$config['size'] = 400;
// jpeg thumbnail image quality
$config['imagequality'] = 70;
// rows of images per page
$config['rows'] = 10;
// columns of images per page
$config['cols'] = 1;
// max page numbers to show at once (so if you have 100 pages, it won't show links to all 100 at once)
$config['maxShow'] = 10;
// folder where full size images are stored (include trailing slash)
$config['fulls'] = "images/";
// folder where thumbnails are to be created (include trailing slash)
$config['thumbs'] = "thumbs/";
#-#############################################
# desc: prints out html for the table and the images found in directory
function PrintThumbs(){
global $config;
// full directory error check
if (!file_exists($config['fulls'])) {
Oops("Fullsize image directory <b>$config[fulls]</b> does not exist.");
}
// thumb directory error check
if (!file_exists($config['thumbs'])) {
if (!@mkdir($config['thumbs'], 0755)) {
Oops("Thumbnail image directory <b>$config[thumbs]</b> does not exist and can not be created. Check directory write permissions.");
}
}
// get the list of all the fullsize images
$imagelist = GetFileList($config['fulls']);
// number of and which images on current page
$config['start'] = ($config['page']*$config['cols']*$config['rows']);
$config['max'] = ( ($config['page']*$config['cols']*$config['rows']) + ($config['cols']*$config['rows']) );
if($config['max'] > count($imagelist)){$config['max']=count($imagelist);}
if($config['start'] > count($imagelist)){$config['start']=0;}
// start table
echo '<table border="0" cellpadding="0" cellspacing="0" align="center" class="gallery">';
echo "<tr>\n<td colspan=\"$config[cols]\" class=\"entries\">";
// "showing results"
if ($config['max'] == "0"){echo "Showing results <b>0 - 0</b> of <b>0</b></td></tr>\n";}
else{echo "Showing results <b>".($config['start']+1)." - $config[max]</b> of <b>".count($imagelist)."</b> entries</td>\n</tr>\n\n";}
$column_counter = 1;
// start row
echo "<tr>\n";
// for the images on the page
for($i=$config['start']; $i<$config['max']; $i++){
$thumb_image = $config['thumbs'].$imagelist[$i];
$thumb_exists = file_exists($thumb_image);
// create thumb if not exist
if(!$thumb_exists){
set_time_limit(30);
if(!($thumb_exists = ResizeImageUsingGD("$config[fulls]$imagelist[$i]", $thumb_image, $config['size']))){
Oops("Creating Thumbnail image of <strong>$config[fulls]$imagelist[$i]</strong> failed. Possible directory write permission errors.");
}
}