Creates a set of thumbnails on a page (at a specified size) of JPEG images from a directory. Filters out any other files, so can be used in any directory not just a /images one.
<?php /* Will generate a pages width of thumbnailed GIF's and JPG's from a secified directory. Will work in a directory with other files in it with no problems. Thumbnail variables are set in gen.php
Generated: 24/3/03 Author: Rock */
// Comments will be throughout
// Set variables $default_dir = "./images"; // Relative to current location
// Directory Scan if(!($dp = opendir($default_dir))) die("Cannot open $dir"); // Place images into image tag while($file = readdir($dp)){ if($file != '.' && $file != '..' && stristr($file,"jpg")) echo "<a href=\"$default_dir/$file\"><img src=\"./gen.php?$default_dir/$file\"></a>\r\n"; }
<?php /* Will generate a pages width of thumbnailed GIF's and JPG's from a secified directory. Will work in a directory with other files in it with no problems. Part 2. The image creator. Aspect ratio is not supported.
// on a problem geneterate an image with ERROR in it else { $im = imagecreate(100,100); $blue = imagecolorallocate($im,0,0,200); $red = imagecolorallocate($im,255,0,0); imagestring($im,2,2,5,"ERROR",$red); imageGIF($im); imagedestroy($im); }
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.