[php图片上传插件]php图片上传并生成水印

更新时间:2015-12-17    来源:php常用代码    手机版     字体:

【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;
?>

本文来源:http://www.bbyears.com/jiaocheng/20286.html

猜你感兴趣