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