JasonO Posted March 1, 2008 Share Posted March 1, 2008 Hi there I have created an image and so far placed text on it using GD for PHP. I now want to add an image on top of the current image. I've done that however the transparency has got a white and green background. I've tried the top methods in Google to removing background to transparent image and they never worked. Image: http://www.gol-clan.net/members/sig/img.php Source: <?php $watermark = imagecreatefrompng('http://i195.photobucket.com/albums/z136/Hexophenia/SGT-Templatecopy.png'); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $img_handle = imagecreatetruecolor($watermark_width, $watermark_height); $img_src = 'http://www.gol-clan.net/members/sig/img/sigbg1.png'; $img_handle = imagecreatefrompng($img_src); $color = imagecolorallocate ($img_handle, 255, 255, 255); $size = getimagesize($img_src); // Get the name in the URL to put in the image $name = $_GET['name']; //Show Text on the image imagestring ($img_handle, 45, 15, 5, "-{GOL}-$name", $color); imagestring ($img_handle, 20, 10, 100, "Medals & Ribbons", $color); imagestring ($img_handle, 20, 400, 5, "Sergeant", $color); $dest_x = $size[0] - $watermark_width - 5; $dest_y = $size[1] - $watermark_height - 25; imagecopymerge($img_handle, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); // Done Image header ("Content-type: image/png"); imagepng ($img_handle); imagedestroy($watermark); imagedestroy($img_handle); ?> Sorry that's its somewhat all over the place. I've commeted what I know, unfortunatly a lot of it I don't know. As you can see, the image has a funny background - however that background is a transparent one when loaded in browser directly. http://i195.photobucket.com/albums/z136/Hexophenia/SGT-Templatecopy.png I'm stuck for ideas, so any help or points in the right direction would be helpful. Thanks a lot, Jason Link to comment https://forums.phpfreaks.com/topic/93796-php-gd-image-transparent-image-has-odd-background/ Share on other sites More sharing options...
JasonO Posted March 1, 2008 Author Share Posted March 1, 2008 Bump. If you want some more information. Apache/2.2.0 (Win32) PHP 5.1.2 GD Version bundled (2.0.28 compatible) Link to comment https://forums.phpfreaks.com/topic/93796-php-gd-image-transparent-image-has-odd-background/#findComment-480978 Share on other sites More sharing options...
JasonO Posted March 5, 2008 Author Share Posted March 5, 2008 Bump again Link to comment https://forums.phpfreaks.com/topic/93796-php-gd-image-transparent-image-has-odd-background/#findComment-484374 Share on other sites More sharing options...
JasonO Posted March 6, 2008 Author Share Posted March 6, 2008 Looks like this is a no win situation. I must be doing something wrong? I've seen plenty of people who use transparent icons etc in dynamic images. Link to comment https://forums.phpfreaks.com/topic/93796-php-gd-image-transparent-image-has-odd-background/#findComment-485292 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.