I have a site where the customer makes multiple selections of clothing and these are shown together at the end of the selection.
So they may select a dress, top and skirt, accessory etc.
All the images are in png format with a transparent background.
At the end of the selection, the preview page shows these individual images layered using z-index.
However, I want to send a thumbnail of a merged image of all these individual png files to a shopping cart.
I have been trying to merge multiple images using php and send the merged file to a folder but so far I have only been able to merge two images and only get it to work with a jpeg output. When I try and output a png, it doesn't seem to work. the jpeg of course doesn't give the transparent background I need. This is the code I have so far....
$photo = imagecreatefrompng("images/animals/cat-left.png"); $w = imagesx($photo); $h = imagesy($photo); imagealphablending($photo,true); $frame = imagecreatefrompng("images/girls-dresses/1.png"); imagecopy($photo,$frame,0,0,0,0,$w,$h); imagepng($photo,"output.png",100); echo '<img src="output.png" />';
Can anyone tell me where I am going wrong please?