Need help with gd, please help! (not a total noob but close)

GD and GD2 are useful libraries for creating graphics on-the-fly. Discuss your PHP GD and GD2 scripts here.

Moderators: onion2k, General Moderators

Post Reply
Pleek
Forum Newbie
Posts: 9
Joined: Fri Jun 05, 2009 5:17 pm

Need help with gd, please help! (not a total noob but close)

Post by Pleek »

Alright, so after asking questions at other forums and not getting much help i have come here. My first question is this...

I have this image as my background image - Background

But when i put it in with gd it looks like this - created png

My problem is that the gd created image has the left corners filled instead of rounded like the actual image. Can somebody help me create a transparent image that i can put my other images on top?

This is my code..

Code: Select all

 
<?php
 
header('Content-type: image/png');
 
// Set a White & Transparent Background Color
$new_image = ImageCreateTruecolor(418, 252);
$bg = ImageColorAllocateAlpha($new_image, 255, 255, 255, 127); // (PHP 4 >= 4.3.2, PHP 5)
ImageFill($new_image, 0, 0 , $bg);
 
$Background = imagecreatefrompng('BackgroundOne.png');
 
imagecopymerge($new_image, $Background, 0, 0, 0, 0, 412, 167, 100);
imagepng($new_image);
imagedestroy($new_image);
imagedestroy($Background);
 
?>
 
Last edited by Benjamin on Sun Jun 07, 2009 11:58 pm, edited 1 time in total.
Reason: Changed code type from text to php.
Post Reply