Page 1 of 1

Image + Image = Image

Posted: Mon Jan 31, 2005 6:38 am
by Dale
Could someone please explain to me (in a demonstration) how I would go about this. Say I have a body (Head, Body, Legs) now how would I (in PHP) get it so the head.png, body.png and legs.png images go together and come out as just 1 .PNG image?

Posted: Mon Jan 31, 2005 3:50 pm
by kettle_drum
First make sure that the gd library is installed and working. Then take the 3 images and get the size of each - getimagesize(). Then create a new image that is as wide as the widest image, and as tall as all three added together - imagecreatetruecolor().

Then copy the three images to the new one, aranging them so that they fit in order - imagecopyresized().

Save or display the image - imagejpeg()..