Right. That's easy enough.
Code: Select all
<?php
$gif1 = imagecreatefromgif("xyz.gif");
$gif2 = imagecreatefromgif("uvw.gif");
$outputgif = imagecreate(imagesx($gif1)+imagesx($gif2),imagesy($gif1));
imagecopy($outputgif,$gif1,0,0,0,0,imagesx($gif1),imagesy($gif1));
imagecopy($outputgif,$gif2,imagesx($gif1),0,0,0,imagesx($gif2),imagesy($gif2));
header("Content-type: image/gif");
imagegif($outputgif);
?>
I've not run that, or checked it very throughly, or anything. Basically it opens both gif files, creates a big image that's the same height as gif1 and the width of both added together, then copies gif1 into it. Then it copies gif2 into it to the right of gif1, and finally it outputs the whole thing.
Things to bear in mind:
0. It requires the GD library with GIF support (either GD 1.6 or a very recent version of 2.0)
1. It assumes both gifs are the same height.
2. It ignores palette differences between the two gifs (if there's more than 256 colours between them it'll look odd.
3. I might have the arguments for imagecopy wrong.