Jump to content

GD transparent background help


pleek

Recommended Posts

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);

?>

 

Link to comment
https://forums.phpfreaks.com/topic/161148-gd-transparent-background-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.