Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.

createthumbnail

This function will create a thumbnail image from an already uploaded image on your server.

createthumbnail

Quote

createthumbnail( int $filetype , string $origfile , string $thumbfile , int $new_w , int $new_h )


Parameters
filetype
This function only supports three filetypes:
1 is .gif files
2 is .jpg files
3 is .png files

origfile
Complete path to the orginal file you want to create a thumbnail of.

thumbfile
Complete path to the thumbnail file you want to create.

new_w
Max width for thumbnail image.

new_h
Max height for thumbnail image.

Return Values
This function will not return anything.

Example
Code
<?php
require_once INCLUDES."photo_functions_include.php";
 
// Set variables
$origfile = IMAGES."banner.png";
$thumbfile = IMAGES."banner_thumb.png";
$new_w = 100;
$new_h = 100;
 
// Determine file extention
$fileext = substr($origfile, strrpos($origfile, '.') + 1);
if ($fileext == "gif") { $filetype = 1;
} elseif ($fileext == "jpg") { $filetype = 2;
} elseif ($fileext == "png") { $filetype = 3;
} else { $filetype = false; }
 
// Create thumbnail
if ($filetype) {
 createthumbnail($filetype, $origfile, $thumbfile, $new_w, $new_h);
 echo "Image sucessfully thumb nailed!";
} else {
 echo "File type not supported!";
}
?>


Changelog
7.01.00 - Added imagedestroy() to lower server load when creating thumbnails for proper destroying temporally thumbnail files when they are created,
7.01.00 - Added support for transparent PNG thumbnails.