The Little Guy
05-10-2006, 02:27 PM
Here is a resizing function That I found, and It isn't working correctly. Basically what it is doing is cropping the image, and making the bottom longer.
function createThumbnail($imageDirectory, $imageName, $thumbDirectory, $thumbWidth)
{
$srcImg = imagecreatefromjpeg("$imageDirectory/$imageName");
$origWidth = imagesx($srcImg);
$origHeight = imagesy($srcImg);
$ratio = $origWidth / $thumbWidth;
$thumbHeight = $origHeight * $ratio;
$thumbImg = imagecreate($thumbWidth, $thumbHeight);
imagecopyresized($thumbImg, $srcImg, 0, 0, 0, 0, $thumbWidth, $thumbHeight, imagesx($srcImg), imagesy($srcImg));
imagejpeg($thumbImg, "$thumbDirectory/$imageName");
}
createThumbnail("images/photos", "$name", "images/photos/thumbs", 100);
function createThumbnail($imageDirectory, $imageName, $thumbDirectory, $thumbWidth)
{
$srcImg = imagecreatefromjpeg("$imageDirectory/$imageName");
$origWidth = imagesx($srcImg);
$origHeight = imagesy($srcImg);
$ratio = $origWidth / $thumbWidth;
$thumbHeight = $origHeight * $ratio;
$thumbImg = imagecreate($thumbWidth, $thumbHeight);
imagecopyresized($thumbImg, $srcImg, 0, 0, 0, 0, $thumbWidth, $thumbHeight, imagesx($srcImg), imagesy($srcImg));
imagejpeg($thumbImg, "$thumbDirectory/$imageName");
}
createThumbnail("images/photos", "$name", "images/photos/thumbs", 100);