This is my first time using GDlib, so I do this an it works well right.
I am doing two imagecopies() -- is that ok?
I want to stack images in order to make a character creator, so Ill have like 5 body parts stacked on top of eachother to create an image. Im not worried about positioning right now.
Is this the best way to go about it?
Would I just repeat this 5 times to get 5 png's layered and then on one image?
Thanks for time, If i fall asleep ill repsond once i wake up, been coding all night :P
PHP Code:
<?php
$stamp = imagecreatefrompng('logo.png');
$stamp2 = imagecreatefrompng('pig.png');
$im = imagecreatefromjpeg('dog.jpeg');
$sx = imagesx($stamp); // Image Height
$sy = imagesy($stamp); // image Width
$sx2 = imagesx($stamp2); // Image Height
$sy2 = imagesy($stamp2); // image Width
// Copy the stamp image onto our photo using the margin offsets and the photo
// width to calculate positioning of the stamp.
imagecopy(
$im,
$stamp,
imagesx($im) - $sx - 10,
imagesy($im) - $sy - 10,
0, 0,
imagesx($stamp),
imagesy($stamp)
);
imagecopy(
$im,
$stamp2,
imagesx($im) - $sx2 - 24,
imagesy($im) - $sy2 - 22,
0, 0,
imagesx($stamp2),
imagesy($stamp2)
);
// Output and free memory
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
Bookmarks