pleek Posted June 6, 2009 Share Posted June 6, 2009 ok, i don't get it. I have scoured the internet for hours on how to fix this but i can't figure out anything. And i can't find anything wrong with my code ether. PLEASE HELP!!! The image looks perfect. But when you save it and open it in photoshop it has a white background. But its supposed to be transparent. Thats my problem. See the image here <?php header('Content-type: image/png'); $new_image = ImageCreateTruecolor(418, 252); imagealphablending($new_image, true); $bg = ImageColorAllocateAlpha($new_image, 255, 255, 255, 127); ImageFill($new_image, 0, 0 , $bg); $Background = imagecreatefrompng('BackgroundOne.png'); $Logo = imagecreatefrompng('CcLogo.png'); $AvatarBackground = imagecreatefrompng('AvatarBackground.png'); $Avatar = imagecreatefrompng('Avatar.png'); $AvatarReflection = imagecreatefrompng('AvatarReflection.png'); $UserRank = imagecreatefrompng('administrator.png'); imagecopy($new_image, $Background, 3, 42, 0, 0, 412, 167); imagecopy($new_image, $Logo, 0, 0, 0, 0, 247, 252); imagecopy($new_image, $AvatarBackground, 5, 44, 0, 0, 134, 164); imagecopy($new_image, $Avatar, 12, 56, 0, 0, 120, 139); imagecopy($new_image, $AvatarReflection, 11, 49, 0, 0, 120, 143); imagecopy($new_image, $UserRank, 280, 50, 0, 0, 128, 28); imagepng($new_image); imagedestroy($new_image); imagedestroy($Background); imagedestroy($Logo); imagedestroy($Avatar); imagedestroy($AvatarReflection); imagedestroy($UserRank); ?> Quote Link to comment https://forums.phpfreaks.com/topic/161148-gd-transparent-background-help/ Share on other sites More sharing options...
.josh Posted June 6, 2009 Share Posted June 6, 2009 image link is not perfect. quick change of the body bg in firebug shows it has a white bg Quote Link to comment https://forums.phpfreaks.com/topic/161148-gd-transparent-background-help/#findComment-850399 Share on other sites More sharing options...
pleek Posted June 6, 2009 Author Share Posted June 6, 2009 thats my problem (quote "looks perfect" not "is"), the white background is supposed to be transparent. Quote Link to comment https://forums.phpfreaks.com/topic/161148-gd-transparent-background-help/#findComment-850611 Share on other sites More sharing options...
Alex Posted June 6, 2009 Share Posted June 6, 2009 Something like.. $trans = imagecolorallocate($img, 255, 255, 255); imagecolortransparent($img, $trans); ? Quote Link to comment https://forums.phpfreaks.com/topic/161148-gd-transparent-background-help/#findComment-850614 Share on other sites More sharing options...
pleek Posted June 7, 2009 Author Share Posted June 7, 2009 ok, that made the background work. (see it here) But now there is this ugly white around the image. How do i fix that? Quote Link to comment https://forums.phpfreaks.com/topic/161148-gd-transparent-background-help/#findComment-851113 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.