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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.