1

PHP (ImageCreateTrueColor), PNG transparence

view story
linux-howto

http://forums.fedoraforum.org – I create a thumb of an uploaded file, however I can not get the alpha layer to display in the thumb, (it displays it as black). I am aware that "ImageCreateTrueColor" starts with a black background. Can someone direct me in the correct direction here. Here is my code: Code: function makeThumb($file, $thumbnail, $size)  {   if(file_exists($file))   {     list ($width, $height) = GetImageSize ($file);     if ($width > $height)     {         // Width greater than height         $newWidth  = $size;         $newHeight = ($newWidth * $height) / $width;     }     else     {         // Height greater than width       $newHeight = $size * .8;       $newWidth  = ($newHeight * $width) / $height;     }         $src    = @ImageCreateFromJPEG ($file);// non prgressive jpg             // use the error for PNG testing code   if ( !$src ) {   $src    = @ImageCreateFromPNG ($file);   $dst    = @ImageCreateTrueColor ($newWidth -1, $newHeight -1);   ImageCopyResized ($dst, $src, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);   ImagePNG ($dst, $thumbnail);   return true;         } I have made the code I feel is causing the problem in Bold Italic. Thanks in advance for any help and/or direction. (HowTos)