本文介绍了Ubuntu 14.04上的ImageMagick没有解码委托的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在开发环境中有效,但在生产环境中无效.
In development enviroment works but not in production enviroment.
生产环境错误:
$e->getMessage():
"no decode delegate for this image format
'/tmp/sws5725c638311df5.24370631' @ error/svg.c/ReadSVGImage/2871"
生成tmpname:
$tmpname = '/tmp/'.uniqid('sws', true);
方法:
public function load($filename)
{
try
{
$this->filename = $filename;
$this->image = new Imagick($filename);
return $this;
}
catch(ImagickException $e)
{
error_log($e->getMessage(), 3, "/tmp/log.log");
OPException::raise(new OPInvalidImageException('Could not create jpeg with ImageMagick library'));
}
}
代表:
convert -list configure | grep DELEGATES
bzlib djvu fftw fontconfig freetype jbig jpeg jng jp2 lcms2 lqr lzma openexr pango png rsvg tiff x11 xml wmf zlib
版本(开发环境和产品环境):
- ImageMagick 6.7.7-10
- Ubuntu 14.04
- PHP 5.5.9-1ubuntu4.16
有什么建议吗?感谢您的关注.
Any suggestions? Thanks for your attention.
推荐答案
临时文件
在使用vim命令查看临时文件时,我收到了来自服务器的XML格式的错误消息,这就是为什么imagick库将其视为svg文件的原因.
In reviewing the temporary file with the command vim I got the error message coming from the server in XML format and is why the library imagick treated it as svg file.
vim /tmp/sws5725c638311df5.24370631
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>RequestTimeTooSkewed</Code>
<Message>The difference between the request time and the current time is too large.</Message>
<RequestTime>Sun, 01 May 2016 06:43:17 GMT</RequestTime>
<ServerTime>2016-05-01T06:28:06Z</ServerTime>
<MaxAllowedSkewMilliseconds>900000</MaxAllowedSkewMilliseconds>
<RequestId>382A337F3660C5A9</RequestId>
<HostId>+2RI3xW5KBd64P13x4yaWly6VdZzn1okvMAYgKvbFYlGnLp87udxpSBCVx7iQNk7zgnkK/ckUXA=</HostId>
</Error>
解决方案
将时间操作系统与服务器时间同步.
Synchronize time operating system with the server time.
sudo service ntp stop
sudo ntpdate ntp.ubuntu.com
sudo service ntp start
感谢您的评论.
这篇关于Ubuntu 14.04上的ImageMagick没有解码委托的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!