server-php-micro-photo-index.php / php
<?php
*********************************************** Micro Photo Gallery Version: 1.0 Date: 2007-04-05 Usage: Just copy these files into your image folder **************************************************
thmb_width = 120; originalImage,toHeight){ // Get the original geometry and calculate scales list(height) = getimagesize(xscale=width/toWidth; height/toHeight; // Recalculate new size with default ratio if (yscale>new_width = round(yscale)); height * (1/new_width = round(xscale)); height * (1/// Resize the original image imageResized = imagecreatetruecolor(new_height); originalImage); imagecopyresampled(imageTmp, 0, 0, 0, 0, new_height, height); return thmb_width,// Open the actual directory if (handle = opendir(".")) { // Read all file from the actual directory while (handle)) { // Check whether tha actual item is a valid file if (is_file(// Check whether the actual image is a thumbnail if (strpos(file,'_th.jpg')){ isThumb = false; } if (!// Process the file string dirName = substr(file,basename(dirName) < 1) fileName = basename(fileMain = substr(fileName,'.')); fileName,strrpos(fileName)-strrpos(// Check if the actual file is a jpeg image if ((extName == '.jpg') || (thmbFile = fileMain.'_th.jpg'; // If a thumbnail dosn't exists tahn create a new one if (!file_exists(file,thmb_height),file){ file,0,strrpos(base.'.jpg')) return base.'.jpeg')) return columns; generateThumbnails(); // Open the actual directory if (handle = opendir(".")) { // Read all file from the actual directory while (handle)) { // Check whether tha actual item is a valid file if (is_file(// Check whether the actual image is a thumbnail if (strpos(file,'_th.jpg')){ ++act > </tr><tr><td class="photo"><a href="'.getNormalImage(file).'"><img src="'.file.'"/></a></td>'; <td class="photo"><a href="'.getNormalImage(file).'"><img src="'.file.'"/></a></td>'; } } } } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Micro Photo Gallery</title> <link href="style/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <div class="caption">Micro Photo Gallery</div> <table align="center"><tr> <?php displayPhotos(); ?> </table> <div id="source">Micro Photo Gallery 1.0</div> </div> </body>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.