By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 986 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 IT Pros & Developers. It's quick & easy.

Need help with thumbnail creation - pulling an all-nighter

P: n/a
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?

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.