Reputation: 1097
Imagine I have 2 pictures, imagea.jpg and imageb.jpg
Image A
Image B
I want to combine these both pictures un just 1 and output them to a file imageab.jpg, just like here
I will do this running cron jobs, so I need to do that on PHP, but I'm getting troubles with previous codes. As additional information, I'm getting the ImageA/B URLs from MySQL and all pictures have the same width and height.
Thanks!
Upvotes: 0
Views: 232
Reputation: 3608
You can use imagecopymerge:
Something like this:
$dest = imagecreatefromgjpg('imagea.jpg');
$src = imagecreatefromjpg('imageb.jpg');
// Copy and merge
imagecopymerge($dest, $src, 10, 10, 0, 0, 100, 47, 75);
// Output and free from memory
header('Content-Type: image/jpeg');
imagejpeg($dest);
imagedestroy($dest);
imagedestroy($src);
Upvotes: 3
Reputation: 5020
Take a look at GD and imagemagick, they are plenty of functions that can help you: http://php.net/manual/en/function.imagecopymerge.php
Upvotes: 1