php - Copy an Image with Drop Shadow and Tranparent Background -


i tried duplicate png image, has drop shadow (i.e. alpha channel) , transparent background. however, resulting image paints shadow , transparent background black. tried imagecopy , imagecopymerge; neither yielded valid results, aren't same original image.

preview of images.

$src = imagecreatefrompng('img_box3-bg.png');  /* using imagecopy. */ $dest = imagecreatetruecolor(116, 100); imagecopy($dest, $src, 0, 0, 0, 0, 116, 100); imagepng($dest, 'img_box3-bg.imagecopy.png'); imagedestroy($dest);  /* using imagecopymerge. */ $dest2 = imagecreatetruecolor(116, 100); imagecopymerge($dest2, $src, 0, 0, 0, 0, 116, 100, 100); imagepng($dest2, 'img_box3-bg.imagecopymerge.png'); imagedestroy($dest2);  imagedestroy($src); 

help? beforehand.

something this:

$src = imagecreatefrompng('img_box3-bg.png');  /* using imagecopy. */ $dest = imagecreatetruecolor(116, 100);  // new imagesavealpha($dest, true); $transparent = imagecolorallocatealpha($dest, 0, 0, 0, 127); imagefill($dest, 0, 0, $transparent);  imagecopy($dest, $src, 0, 0, 0, 0, 116, 100);  header('content-type: image/png'); imagepng($dest); imagedestroy($dest); 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -