I'm having trouble with the functions for resizing a picture uploaded to my
server. Consider the following:
$jpeg = imagecreatefromjpeg($filePath); //I know this works!
$oldX = imageSX($jpeg);
$oldY = imageSY($jpeg);
$thumbH = 100;
$thumbW = ($oldX / $oldY) * 100; //I know the dimensions are correct
$thumbnail = ImageCreateTrueColor($thumbW, $thumbH);
if(!ImageCopyResampled($thumbnail, $jpeg, 0, 0, 0, 0, $thumbW, $thumbH,
$oldX, $oldY)) {
print 'Error message<br />';
return;
}
//No error is produced, so the system thinks the image copy worked.
imagejpeg($thumbnail, 'thumb.jpg');
I get an thumbnail image that is completely black. I did not get an error
from the copy, so the system thinks it works - but nothing was copied.
Can someone please give some help?