Jump to content

Recommended Posts

I've got the basics of PHP GD sorted but I have a problem. As part of my dynamic image, I want to load another image into it. So I want to insert an image with a given URL into the image at a given position. I also want to blend that image with a particular colour.

 

Essentially, I want this function to exist:

coolnewfunction($im,"images/image.png",$x,$y,$color)

Where $im is the image I'm creating, $x and $y give the location to insert it at and $color is the colour to blend it with.

 

Is it possible to load an image into a GD image and, if so, is it possible to blend that with a colour before I add it?

 

And if yes, I'd obviously like to know how. Thanks in advance =)

Link to comment
https://forums.phpfreaks.com/topic/90548-php-gd-inserting-images/
Share on other sites

I'm pretty sure you can but my GD experience hasn't been too extensive other than creating thumbs. You probably want to create a new image resource and create another image resource from the source image. Then use one of the imagecopy (http://ca.php.net/manual/en/function.imagecopymerge.php) functions to overlay. I'm not sure about the blending part thought. It's probably a little tricky.

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.