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*$a spect;
}
$tim = ImageCreateTrue Color($thumbwid th,$thumbheight );
imagealphablend ing($tim, FALSE);
imagesavealpha( $tim, TRUE);
$myBool = imagecopyresamp led( $tim, $im, 0, 0, 0, 0, $thumbwidth,
$thumbheight, $width, $height);
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*$a spect;
}
$tim = ImageCreateTrue Color($thumbwid th,$thumbheight );
imagealphablend ing($tim, FALSE);
imagesavealpha( $tim, TRUE);
$myBool = imagecopyresamp led( $tim, $im, 0, 0, 0, 0, $thumbwidth,
$thumbheight, $width, $height);
Comment