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 Quote Link to comment 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) Quote Link to comment Share on other sites More sharing options...
JasonO Posted March 5, 2008 Author Share Posted March 5, 2008 Bump again Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.