0
合并我要让来自多个image.In我的图像列表中有最大的6个image.i一个图像想side.as例如,要添加的所有图像侧PHP图片来自多个图像
1st image | 2nd image
3rd image | 4th image
5th image | 6th image
我正在写一个代码,使图像垂直。
我的代码
<?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);
?>
但我想放置的图像动态地导致图像项可以是4或5或6或1或2或3
但如何?
也许这个答案有帮助: http://stackoverflow.com/questions/23121488/php-gd-merge-multiple-images-in-tiled-layout – Jesus 2014-12-02 20:58:56