|
Posted by Bint on 06/13/07 17:10
Hello,
I'm trying to create thumbnails of PNG images. I have code that used to
work but doesn't seem to anymore. The resizing just seems to return black
images, even though my source image is not black. Anyone know what could be
the problem?
Here's my code:
$width = imagesx($im);
$height = imagesy($im);
if ($width >= $height) {
if ($width > 32)
$thumbwidth = 32;
else $thumbwidth = $width;
$aspect = $width/$height;
$thumbheight = $thumbwidth/$aspect;
}
else {
if ($height > 32)
$thumbheight = 32;
else $thumbheight = $height;
$aspect = $width/$height;
$thumbwidth = $thumbheight*$aspect;
}
$tim = ImageCreateTrueColor($thumbwidth,$thumbheight);
imagealphablending($tim, FALSE);
imagesavealpha($tim, TRUE);
$myBool = imagecopyresampled( $tim, $im, 0, 0, 0, 0, $thumbwidth,
$thumbheight, $width, $height);
[Back to original message]
|