topical media & game development
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;
yscale>new_width = round(yscale));
height * (1/new_width = round(xscale));
height * (1/imageResized = imagecreatetruecolor(new_height);
originalImage);
imagecopyresampled(imageTmp, 0, 0, 0, 0, new_height, height);
return thmb_width,handle = opendir(".")) {
// Read all file from the actual directory
while (handle)) {
// Check whether tha actual item is a valid file
if (is_file(file,'_th.jpg')){
isThumb = false;
}
if (!dirName = substr(file,basename(dirName) < 1) fileName = basename(fileMain = substr(fileName,'.'));
fileName,strrpos(fileName)-strrpos(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();
handle = opendir(".")) {
// Read all file from the actual directory
while (handle)) {
// Check whether tha actual item is a valid file
if (is_file(file,'_th.jpg')){
++act > file).'"><img src="'.file.'"/></a></td>';
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.