Reply to imagecopyresampled not working

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация