|
Posted by Steve on 11/29/06 04:34
contents of get.thumb.nail.php:
<?
require_once 'site.cfg.php';
require_once $site->includeDirectory . 'functions.inc.php';
$fileName = $_REQUEST['fileName'] ? $_REQUEST['fileName'] :
$_REQUEST['altImage'];
$maxSize = $_REQUEST['maxSize'] ? $_REQUEST['maxSize'] : 200;
$filePath = $site->imagesDirectory;
if (!(isSupportedImage($fileName) || isSupportedMedia($fileName)))
{
$fileName = isSupportedMedia($fileName) ? 'media.jpg' :
'document.jpg';
$filePath = $site->imagesDirectory;
}
$fileData = @file_get_contents($filePath . $fileName);
$originalImage = @imagecreatefromstring($fileData);
@list($imageWidth, $imageHeight, $imageType, $imageAttributes) =
@getimagesize($filePath . $fileName);
$newImageHeight = $imageWidth < $maxSize ? $imageHeight : ($imageHeight /
$imageWidth) * $maxSize;
$newImageWidth = $imageWidth < $maxSize ? $imageWidth : $maxSize;
$thumbNail = @imagecreatetruecolor($newImageWidth, $newImageHeight);
@imagecopyresampled(
$thumbNail,
$originalImage,
0,
0,
0,
0,
$newImageWidth,
$newImageHeight,
@imagesx($originalImage),
@imagesy($originalImage)
);
@imagejpeg($thumbNail);
@imagedestroy($thumbNail);
@imagedestroy($originalImage);
?>
[Back to original message]
|