2014-11-04 33 views
0
$image = new Imagick("Koala.jpg"); 

$imageprops = $image->getImageGeometry(); 

if ($imageprops['width'] > 640) { 
    $image->resizeImage(640,425, imagick::FILTER_LANCZOS, 0.9, true); 
    $image->writeImage("Koala_new.jpg"); 
} 

我试图使用Imagick从Windows 7示例图片调整考拉图片的大小。然而,只要我运行resizeImage,我发送请求运行这个PHP文件后200 200毫秒的错误。我正在运行PHP 5.3.29,在configure命令中启用ImageMagick 6.8.6-9和cgi/fastcgi。调整图像大小给出内部服务器错误

错误日志显示以下内容:

[Mon Nov 03 20:19:56 2014] [warn] [client **.**.**.**] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server 
[Mon Nov 03 20:19:56 2014] [error] [client **.**.**.**] Premature end of script headers: imagetest.php 

是不是有什么毛病FastCGI的安装?

回答

1

希望你做得很好。

下面我给出了代码。

<?php 

$thumb = new Imagick(); 
$thumb->readImage('myimage.gif');  
$thumb->resizeImage(320,240,Imagick::FILTER_LANCZOS,1); 
$thumb->writeImage('mythumb.gif'); 
$thumb->clear(); 
$thumb->destroy(); 

?> 

或者更短的版本相同的:

<?php 

$thumb = new Imagick('myimage.gif'); 

$thumb->resizeImage(320,240,Imagick::FILTER_LANCZOS,1); 
$thumb->writeImage('mythumb.gif'); 

$thumb->destroy(); 

?> 

除此之外,我给你这永远是可行的与您可以使用相同的两个选项。

希望这可能会让你的一天!

等待着你的意见:)

干杯:P :)