This is a very useful script when you have hundreds of images and you need a quick setup for a thumbnail, where you can select how many pictures per row, size of the thumbnail, and the size of the pictures when clicked, all in one script. Just throw all your images and this script in a file named index.php or index.html (if your apache httpd.conf defaults to html and runs .html as php). Script also contains simple text watermarking. See function thumbImage() and modify to add image watermarking if you like. " . createThumbTable($files,$row_size) . ""; } function createThumbTable($files,$pics_wide) { $row = intval(count($files)/$pics_wide); $picIndex = 0; $rs = "Mostrando " . count($files) . " imagenes
"; $rs .= "\n"; for ($i=0; $i <$row; $i++) { $rs .= "\t\n"; for ($picIndex,$j=0; $j < $pics_wide && $picIndex < count($files); $j++,$picIndex++) { $rs .= "\t\t\n"; //$rs .= ""; } $rs .= "\t\n"; }//for $rs .= "
" . "i=$i / $j=$picIndex
Free Thumbnail script by wedoit4you.com
Written by Angel Leon (March 2005)
\n"; return $rs; } //createThumbTable function thumbImage($file,$img_height,$waterMark) { $img_temp = imagecreatefromjpeg($file); $black = @imagecolorallocate ($img_temp, 0, 0, 0); $white = @imagecolorallocate ($img_temp, 255, 255, 255); $font = 2; $img_width=imagesx($img_temp)/imagesy($img_temp)*$img_height; $img_thumb=imagecreatetruecolor($img_width,$img_height); imagecopyresampled($img_thumb, $img_temp,0,0,0,0,$img_width, $img_height, imagesx ($img_temp), imagesy($img_temp)); $originx = imagesx($img_thumb) - 100; $originy = imagesy($img_thumb) - 15; @imagestring ($img_thumb, $font, $originx + 10, $originy, $waterMark, $black); @imagestring ($img_thumb, $font, $originx + 11, $originy - 1, $waterMark, $white); header ("Content-type: image/jpeg"); imagejpeg($img_thumb, "", 60); imagedestroy ($img_thumb); } ?>