PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun Dec 21, 2014 6:21 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Aug 16, 2005 1:30 pm 
Offline
Forum Newbie

Joined: Tue Aug 16, 2005 1:22 pm
Posts: 2
Hello,

I am tryign to create a transparent image and draw a white line that has to me smooth.
This should be a problem right?
Well I got serious problems with it.
Let me show you:

This url has my example images and the code below (I couldn't use the [img] tag to show the php generated images.
http://www.zacay.se/image/

Method 1:
Syntax: [ Download ] [ Hide ]
<?

header("content-type: image/png");



// Create empty image

$image = imagecreatetruecolor(500, 500);



// The image background transparent

imagealphablending($image, false);

imagesavealpha($image, true);

$bgcolor = imagecolorallocatealpha($image, 255, 255, 255, 127);

imagefill($image, 0, 0, $bgcolor);



// Drawing the lines

imageantialias($image, true);

$white = imagecolorallocate($image, 255, 255, 255);

imageline($image, 0, 0, 250, 500, $white);

imageline($image, 0, 100, 500, 500, $white);

imageline($image, 0, 300, 500, 400, $white);

imageline($image, 0, 400, 500, 450, $white);



// Output the image

imagepng($image);

?>


Method 2:
Syntax: [ Download ] [ Hide ]
<?

header("content-type: image/png");



// Create empty image

$image = imagecreatetruecolor(500, 500);



// The image background transparent

imagealphablending($image, true);

imagecolortransparent($image, 0); // 0 = black, the default color then create an image



// Drawing the lines

imageantialias($image, true);

$white = imagecolorallocate($image, 255, 255, 255);

imageline($image, 0, 0, 250, 500, $white);

imageline($image, 0, 100, 500, 500, $white);

imageline($image, 0, 300, 500, 400, $white);

imageline($image, 0, 400, 500, 450, $white);



// Output the image

imagepng($image);

?>


So any ideas?
Am I doing this the wrong way?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 16, 2005 1:39 pm 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
  1. using
    Syntax: [ Download ] [ Hide ]
    tags helps us, help you.</li><li>Moved to <span style="font-weight: bold">Graphics</span>.</li></ol>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 20, 2005 4:29 pm 
Offline
Forum Newbie

Joined: Tue Aug 16, 2005 1:22 pm
Posts: 2
Anyone please?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group