Elliot
Elliot

Reputation: 2289

PHP add two images together

How do I merge two images together with imagemagick, so that the bottom of image a is joined to the top of image b?

Upvotes: 2

Views: 443

Answers (1)

RiaD
RiaD

Reputation: 47619

lets $imtop and $imbottom are our images

//imagesx($imtop)==imagesx($imbottom)
$new=imagecreatetruecolor(imagesx($imtop),imagesy($imtop)+imagesy($imbottom));
imagecopy($new,$imtop,0,0,0,0,imagesx($imtop),imagesy($imtop));
imagecopy($new,$imbottom,0,imagesy($imtop),0,0,imagesx($imbottom),imagesy($imbottom));
//use $new

Upvotes: 1

Related Questions