【www.bbyears.com--php常用代码】
header("Content-Type:text/html;charset=gb2312");
$animation = new Imagick();
$animation->setFormat( "gif" );
$image = new Imagick("/skin/".$_GET["ys"].".gif");
$unitl = $image->getNumberImages();
for ($i=0; $i<$unitl; $i++) {
$image->setImageIndex($i);
$first = new Imagick($_GET["yh"]);
$bl = new Imagick("/skin/bl.jpg");
$thisimage = new Imagick();
$thisimage->readImageBlob($image);
$srcwh = $thisimage->getImageGeometry();
$bl->thumbnailImage ($srcwh["width"],$srcwh["height"],false);
if ($_GET["kuan"]==0 and $_GET["gao"]==0)
{
$first->thumbnailImage ($srcwh["width"],$srcwh["height"],false); //这里false就是拉伸了 true为不拉伸
}
else
{
$first->thumbnailImage ($_GET["kuan"],$_GET["gao"],false); //这里false就是拉伸了 true为不拉伸
}
$bl->compositeImage($first,Imagick::COMPOSITE_OVER,$_GET["x"],$_GET["y"]);
$delay = $thisimage->getImageDelay();
$bl->compositeImage($thisimage,Imagick::COMPOSITE_OVER,0,0);
$animation->addImage($bl);
$animation->setImageDelay( $delay );
}
$picname=date("ymdhs")."_".mt_rand(10000,99999).".gif";
$name = "/user/".$picname;
$animation->writeImages($name,1);
echo "
下载图片 复制图片
";
//header( "Content-Type: image/gif" );
//echo $animation->getImagesBlob();
//echo $animation;
?>