Jump to content

gd library draw transparent rectangle, then text over it


dcgamers

Recommended Posts

Well, create the image as you said you have then create a rectangle

 

<?php 
ImageCreate(600,300);
?>

 

fill it with colour etc.. then write the text onto that image.

 

Then use

 

<?php 
ImageCopyMerge($image, $im, dst_x, dst_y, src_x, src_y, src_w, src_h, 50);
?>

 

Where $image is the original image and $im is the new rectangle.

 

Hope that helps,

 

Sam

how is image copy merge going to help? And I said 50% transparent. I mean a rectangle inside an ALREADY created image, of course the image itself is a rectangle.

 

Well, you first said

 

"How can I draw a 50% semi-transparent object over the image"

-therefore I assumed you meant a new object (a new image, a new rectangle!) which is where image create comes in.. then if you fill the rectangle with a colour you have the original image and that one.. then use image copy merge to have the new image over the old image.

 

"And I said 50% transparent"

- that's where the 50 at the end of the Image Copy Merge function I quoted. 100 will be solid colour just the object slap bang onto the image; 0 would be non-existant so 50 will be in between, it will be semi-transparent.

 

But either way, try Barand's idea too.

 

Sam

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.