|
|
|
|
|
|
| |
|
<?php
// quick thumbnailer
// pretty self explanatory, uses PHP GD to thumbnail photographs in the directory marked by $config['path'];
// just a three minute script thats good for people looking for an easy quick thumbnailer.
// ~dovka
$config = array();
$config['path'] = "./";
$config['t_width'] = 120;
$config['t_height'] = 98;
$config['ignore'] = array("",".","..");
$config['prefix'] = "thumb_";
// don't edit below this line
// start with defining variables
$done = 0;
define("IMAGE_JPG", 2);
define("ENDL", "\n");
if($handle = opendir($config['path'])) {
while(false !== ($file = readdir($handle))) {
if(!array_search($file,$config['ignore'])) {
// check for JPG
list($im_width, $im_height, $type) = getimagesize($file);
if($type != IMAGE_JPG) {
continue;
}
$op .= "found -> <a href='{$file}'>$file</a>" . ENDL;
$im = @imagecreatefromjpeg($file);
if(!$im) {
$op .= "fail -> couldn't create sour image pointer." . ENDL;
continue;
}
if(file_exists($config['prefix'] . $file) || substr($file, 0, strlen($config['prefix'])) == $config['prefix']) {
$op .= "note -> this file has already got a thumbnail." . ENDL;
continue;
}
$to = imagecreatetruecolor($config['t_width'],$config['t_height']);
if(!$to) {
$op .= "fail -> couldn't create dest image pointer." . ENDL;
continue;
}
if(!imagecopyresampled($to, $im, 0, 0, 0, 0, $config['t_width'], $config['t_height'], $im_width, $im_height)) {
$op .= "fail -> couldn't create thumbnail. php fail." . ENDL;
continue;
}
// save file
imagejpeg($to, $config['prefix'] . $file);
$op .= "done -> created thumb: <a href='{$config['prefix']}{$file}'>{$config['prefix']}{$file}</a>" . ENDL;
$done++;
}
}
}
closedir($handle);
$op .= "fin -> {$done} file(s) written" . ENDL;
echo "<pre>";
echo $op;
echo "</pre>";
exit;
?> | | |
|
| crop and resize image class using gd library function Categories : PHP, PHP Classes, GD image library, Graphics | | | Create Thumbnails - resize an image - jpeg, jpg, gif, png to the specifed width and height in proportion without loosing out on pixcel quality. Categories : PHP, GD image library, Graphics | | | Create a Thumbnail Using PHP, GD and Exif Categories : PHP, Graphics, Exif, GD image library | | | PHP Email image generator - hide your email from bots - using the GD Library Categories : PHP, Graphics, GD image library, Beginner Guides | | | Advanced Image WaterMarker Categories : PHP, PHP Classes, GD image library, Graphics, Object Oriented | | | Simple PHP Bar Graph using GD library Categories : PHP, GD image library, Graphics, Arrays | | | Line graphics generation library written in PHP + GD library (spanish comments) Categories : PHP, Graphics, GD image library | | | A captcha image allows you to prevent spam posting when users reload the page and stop bots from submitting forms automatically. This version allows you to use your own fonts (.ttf) to show the text.
Categories : PHP, Security, Graphics, GD image library | | | EasyPhpThumbnail Class - The EasyPhpThumbnail class allows you to generate thumbnails and handle image manipulation for GIF, JPG and PNG on-the-fly. Categories : PHP, PHP Classes, Object Oriented, Graphics, GD image library | | | PHP Image Compression using GD library Categories : PHP, Compression, GD image library, Graphics | | | Image Generation Class ( PNG Format ) Categories : PHP, GD image library, PHP Classes, Graphics | | | a simple pie-chart in php3 (with gd) Categories : PHP, Graphics, GD image library, Charts and Graphs | | | Display a bar chart based on random values. Categories : Graphics, PHP, GD image library, Charts and Graphs | | | CAPTCHA[Image verification] Categories : PHP, Security, GD image library, Graphics, Sessions | | | imageMarker v 3.00 with new advanced features Categories : PHP, PHP Classes, Graphics, GD image library | |
|
|