Originally posted by Dax
i would greatly appreciate it if i could have the script after i click on thumbnail on your site...
thats exactly what i need
here's the one I used to use (now I use db's for my images)
<?
$incldir="thumbs/"; // thumbnail directory
$directory="images/"; // image directory
$pagenum=$QUERY_STRING;
if ( $pagenum == NULL ) {
$pagenum=1;
}
$realpage=$pagenum - 1;
$linecount=0;
$d2 = dir($incldir);
while($entry=$d2->read()) {
if ( $entry != "." && $entry != ".." && $entry != ".total" ) {
$linecount++;
}
}
//change the 10 to whatever # per page
$pagecount=$realpage * 10 + 1;
$endcount=$pagecount + 10;
$totalpages=floor($linecount / 10);
$rtotalpages=$linecount % 10;
if ( $rtotalpages >= 1 ) {
$totalpages++;
}
$currcount=1;
$d2 = dir($incldir);
while($entry=$d2->read()) {
if ( $entry != "." && $entry != ".." ) {
if ( $currcount < $endcount && $currcount >= $pagecount )
{
echo "<a href=\"".$directory."${entry}\"><img src=\"".$incldir."${entry}\" border=0></a> ";
}
$currcount++;
}
}
echo "<br><Br>";
$back=$pagenum - 1;
$next=$pagenum + 1;
if ( $back < "1" ) {
echo " ";
} else {
echo "<A href=\"".$PHP_SELF."?$back\"><<</a>";
echo " ";
}
$totalpagecount=1;
while ( $totalpagecount <= $totalpages ) {
if ( $totalpagecount == $pagenum ) {
echo "<b>$totalpagecount</b> ";
} else {
echo "<a href=\"".$PHP_SELF."?$totalpagecount\">$totalpagecount</a> ";
}
$totalpagecount++;
}
if ( $next > $totalpages ) {
echo " ";
} else {
echo "<A href=\"".$PHP_SELF."?$next\">>></a>";
}
?>
basically, your images have to have the same image names for this to work, your thumbs go in your $incldir and your regular images go in your $directory.
If you have GD V 2.0 installed on your server, you can use this... just point the img src to thumb.php?url=${entry}
<?php
header("Content-type: image/jpeg");
$filename = $url;
$filename = str_replace(" ", "%20", $filename);
$filen = $_FILES[filename][name];
$filet = $_FILES[filename][type];
$imageInfo = getimagesize($filename);
$old_w = $imageInfo['0'];
$old_h = $imageInfo['1'];
if ($old_w>=$old_h)
{
$width=$size;
$height = ($width/$old_w)*$old_h;
}
else
{
$height=$size;
$width = ($height/$old_h)*$old_w;
}
$img_src ="$filename";
$dst_img=ImageCreateTrueColor($width,$height);
$src_img=ImageCreateFromJpeg("$filename");
imagecopyresampled($dst_img,$src_img,0,0,0,0,$width,$height,$old_w,$old_h);
ImageJpeg($dst_img, '', 75);
?>