Home  >  Article  >  Backend Development  >  Fatal error: Uncaught exception 'ImagickException' with message 'Compositing ima

Fatal error: Uncaught exception 'ImagickException' with message 'Compositing ima

WBOY
WBOYOriginal
2016-06-23 13:49:421640browse

$image_name4=$Process.'4.gif';$inimg3=$Process.'1.jpg';$animation3 = new Imagick();		$animation3->setFormat("gif");		$i=0;		$image4 = new Imagick(realpath($image_name4));		$image4 = $image4->coalesceImages();foreach($image4 as $frame){ 			if(!is_file($inimg3)){				echo  '水印图像不存在';			}			$img = new Imagick();			$img->readImageBlob($frame);			$draw = new ImagickDraw();			$draw->color(0,0,imagick::PAINT_FLOODFILL);			$water = new Imagick(realpath($inimg3));			$draw->composite($water->getImageCompose(),0,0,320, 256,$water);			$img->drawImage($draw);                        $animation3->addImage( $img );			$animation3->setImageDelay( $img->getImageDelay() );//			$draw->destroy();                        $water->destroy();			$img->destroy();}$animation3->writeImages($Process.''.$id.'X.gif', true);//生成3X		$animation3->destroy();


在Linux 下报错,本地win7是好的:Uncaught exception 'ImagickException' with message 'Compositing image failed' 。
ImagickDraw->composite(40, 0, 0, 320, 256, Object(Imagick)) #1 {main} thrown in



回复讨论(解决方案)

目测应该是你的linux下的php中没有imagick扩展。

linux上有这个。。版本也升到最新了

不是  new Imagick();不行,而是单独 
 $draw->composite($water->getImageCompose(),0,0,320, 256,$water); 这一句执行不了

getImageCompose()
这个方法有返回值?

getImageCompose()
这个方法有返回值?

有的 这个设置gif延迟的,值为40.

最后还是放弃了composite方法  以后看怎么样能正确使用 再更新下吧

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn