Jump to content

PHP GD Inserting Images


Grego

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.

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.