I want to make a image from multiple image.In my image list have maximum 6 image.i want to add all image side by side.as example
1st image | 2nd image
3rd image | 4th image
5th image | 6th image
I am writing a code that makes image Vertically.
my code
<?php
$numberOfImages = 6;
$x = 940;
$y = 920;
$background = imagecreatetruecolor($x, $y*6);
$firstUrl = 'e.jpg';
$secondUrl = 'f.jpg';
$thirdUrl = 'f.jpg';
$fourthUrl = 'e.jpg';
$fiveUrl = 'f.jpg';
$sixUrl = 'f.jpg';
$outputImage = $background;
$first = imagecreatefromjpeg($firstUrl);
$second = imagecreatefromjpeg($secondUrl);
$third = imagecreatefromjpeg($thirdUrl);
imagecopymerge($outputImage,$first,0,0,0,0, $x, $y,100);
imagecopymerge($outputImage,$second,0,$y,0,0, $x, $y,100);
imagecopymerge($outputImage,$third,0,$y*2,0,0, $x, $y,100);
imagejpeg($outputImage, APPLICATION_PATH .'test.jpg');
imagedestroy($outputImage);
?>
But i want to placed image dynamically cause image item could be 4 or 5 or 6 or 1 or 2 or 3
But how?