QWERTYtech Posted December 12, 2008 Share Posted December 12, 2008 I was looking for a script that will read a directory and automatically create thumbnails of the images in it and then allow you to click on them to open the full image. Does anyone have anything or know of anything out there? Quote Link to comment Share on other sites More sharing options...
corbin Posted December 12, 2008 Share Posted December 12, 2008 It wouldn't be hard to code your self. I'm sure you could find something already made though. http://php.net/gd Everything you need. Quote Link to comment Share on other sites More sharing options...
MadnessRed Posted December 15, 2008 Share Posted December 15, 2008 I think i have the script for you, 1 sec... <?php $file = $_GET['source']; list($width,$height)=getimagesize($file); $type = exif_imagetype($file); //Types /* 1 IMAGETYPE_GIF 2 IMAGETYPE_JPEG 3 IMAGETYPE_PNG 4 IMAGETYPE_SWF 5 IMAGETYPE_PSD 6 IMAGETYPE_BMP 7 IMAGETYPE_TIFF_II (intel byte order) 8 IMAGETYPE_TIFF_MM (motorola byte order) 9 IMAGETYPE_JPC 10 IMAGETYPE_JP2 11 IMAGETYPE_JPX 12 IMAGETYPE_JB2 13 IMAGETYPE_SWC 14 IMAGETYPE_IFF 15 IMAGETYPE_WBMP 16 IMAGETYPE_XBM */ if($type == 2){ $src = imagecreatefromjpeg($file); }elseif($type == 3){ $src = imagecreatefrompng($file); }elseif($type == 1){ $src = imagecreatefromgif($file); }else{ die("Unsupported file type (".$type.")"); } if($width > $height){ $newwidth=200; $newheight=($height/$width)*$newwidth; }else{ $newheight=200; $newwidth=($width/$height)*$newheight; } $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); header("Content-type: image/jpeg"); imagejpeg($tmp, NULL,100); imagedestroy($src); imagedestroy($tmp); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.