ImageMagick文件太大

时间:2018-07-16 12:20:55

标签: php imagemagick imagemagick-convert

我正在与imagemagick合作,将图像从.tiff转换为.jpeg并使其拇指化。从.tiff到.jpeg的对话还可以,但是当我想使用imagemagick移至其他分辨率的其他文件夹并创建其缩略图时,问题就来了。 Imagemagick说$path.$destinationPath.$ref.".jpeg"中的图像太大,但是该图像不存在...

-这是我的代码:

exec("/usr/bin/convert ".$tiffPath.$ref.".tiff  ".$CommonPath.$sourcePath.$ref.".jpeg");

// Ok until here

if (!file_exists($CommonPath.$destinationPath.$ref.".jpeg"))
{
    $executa = "/usr/bin/convert -size 800x800 ".$CommonPath.$sourcePath.$ref.".jpeg -thumbnail 800x800 ".$path.$destinationPath.$ref.".jpeg";

    exec($executa);
}

Imagemagick返回以下内容:

convert: unable to open image $CommonPath.$destinationPath.$ref.".jpeg": File is too big @ error/blob.c/OpenBlob/2589.

谢谢!

1 个答案:

答案 0 :(得分:1)

您的第二个ImageMagick命令格式错误。你有:

$executa = "/usr/bin/convert -size 800x800 ".$CommonPath.$sourcePath.$ref.".jpeg -thumbnail 800x800 ".$path.$destinationPath.$ref.".jpeg";


-size 800x800用于通过xc:或canvas:创建新图像。认为您有两个输入图像可能会使命令行混淆。当然不需要。尝试将其删除,例如

$executa = "/usr/bin/convert ".$CommonPath.$sourcePath.$ref.".jpeg -thumbnail 800x800 ".$path.$destinationPath.$ref.".jpeg";
相关问题