php功能-php实现多张图片合并为一张

2012.12.25 No Comments
Wayde:

<?php
class MergeImg{
function __construct($array){
// 初始化
global $count,$imgs;
$count = count($array);
$imgs = $array;
}

function show(){
header("Content-type: image/jpeg");
global $count,$imgs;

$dests = imagecreatetruecolor(950,$count*450);
foreach($imgs as $key=>$imag){
$source = imagecreatefromjpeg($imag);
imagecopy($dests,$source,0,450*$key,0,0,950,450);
imagedestroy($source);
}

imagejpeg($dests);

}

}

$imgs = array('1.jpg','2.jpg','3.jpg','4.jpg');
$Img = new MergeImg($imgs);
print "{$Img->show()}";
?>

合并图片

Related Posts:

评论已关闭。