thumbnails of transparent background gifs
am 27.09.2007 16:34:15 von Sandy.PittendrighThe following resize stuff does not work for gifs with transparent
backgrounds. What would make it work?
function Create()
{
switch($this->ImageType)
{
case ".gif":
$this->ImageObj =
imagecreatefromgif($this->ImageUrl);
break;
//snip other cases
}
}
function ResizePct($Percent)
{
list($Width, $Height) = getimagesize($this->ImageUrl);
$NewWidth = intval(($Width * $Percent) / 100);
$NewHeight = intval(($Height * $Percent) / 100);
$this->ResizedImage = imagecreatetruecolor($NewWidth,
$NewHeight);
imagecopyresampled($this->ResizedImage, $this-
>ImageObj, 0, 0, 0, 0,
$NewWidth,
$NewHeight, $Width, $Height);
switch($this->ImageType)
{
case ".gif":
imagegif($this->ResizedImage,$this-
>ThumbnailUrl);
break;
//snip other cases
}
}