Okay, so I have two images in a file. One of them is of a t-shirt. The other is of a logo. I used CSS to style the two images so that it looks like the logo is written on the t-shirt. I merely gave the image of a logo a higher z-index in the CSS style sheet. Is there anyway that I could generate an image of both the shirt and the image combined as one using the GD library?
Thanks,
Lance
Yes.
http://php.net/manual/en/book.image.php
This tutorial should get you started http://www.php.net/manual/en/image.examples.merged-watermark.php and on the right track
It's possible. Sample code:
If you don't want to specify a transparent color, but instead want to use an alpha channel, you have to use
imagecopy
instead ofimagecopymerge
. Like this:References:
imagecreatefrompng
imagecolortransparent
imagesx
imagesy
imagecopymerge
imagecopy
Tutorial from PHP.net to watermark images
Tutorial from PHP.net to watermark images (using an alpha channel)