0

我遇到了以下代码的一个奇怪问题:

$image = new Imagick($real_location); 
$ident = $image->identifyImage(); 
$format = $ident['colorSpace'];

在大多数情况下,这很好。但在某些照片上,它会重置连接,基本上看起来页面已经超时。

示例照片是 72dpi、3008x2000、包含 EXIF 数据、RGB、8 位通道的 JPG。

如果我像下面那样运行它,它很好:

exec("identify -format %r  ".$real_location,$output);

但是,我宁愿远离 exec() 并尽可能坚持使用图书馆。

我查看了我的 PHP 错误日志,发现了以下内容:

httpd: magick/option.c:1264: GetImageOption: Assertion `image_info != (ImageInfo *) ((void *)0)' failed.
[Mon Mar 26 15:40:26 2012] [notice] child pid 1582 exit signal Aborted (6)
4

1 回答 1

1

我做了一些进一步的调查,我想做的是检查图像是否是 CMYK。我发现以下代码修复了我的原因,但没有修复错误:

$image = new Imagick($real_location);
$ident = $image->getImageColorspace();  
if($ident ==  Imagick::COLORSPACE_CMYK) {

}
于 2012-03-26T15:02:56.563 回答