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

Link to comment
Share on other sites

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

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.