简体   繁体   English

当我从SVG中读取内容时,为什么我的ImageMagick / Imagick设置总是崩溃?

[英]Why does my ImageMagick / Imagick setup always crash when I read from an SVG?

I'm running ImageMagick 6.7.4-0 and Imagick 3.0.1. 我正在运行ImageMagick 6.7.4-0和Imagick 3.0.1。

I have all of the delegates necessary for SVG (output of convert -list configure | grep DELEGATES shows bzlib djvu fontconfig freetype gvc jpeg jng jp2 lcms lqr openexr png rsvg tiff x11 xml wmf zlib ). 我拥有SVG所需的所有代表( convert -list configure | grep DELEGATES bzlib djvu fontconfig freetype gvc jpeg jng jp2 lcms lqr openexr png rsvg tiff x11 xml wmf zlib输出显示bzlib djvu fontconfig freetype gvc jpeg jng jp2 lcms lqr openexr png rsvg tiff x11 xml wmf zlib )。

Here is some sample PHP code to convert a very simple SVG into a PNG: 这是一些示例PHP代码,用于将非常简单的SVG转换为PNG:

$file = 'baseball.svg';
$im = new Imagick();
$im->readImage($file);
$im->setImageFormat("png32");
header("Content-Type: image/png");
print $im->getImageBlob();

I get a 503 response from the server; 我从服务器收到503响应; PHP reports nothing and logs nothing. PHP不报告任何内容,也不记录任何内容。 I have all php errors enabled, display errors enabled, log errors enabled, etc. I can convert from .png to .jpg and all of that just fine. 我已启用所有php错误,已启用显示错误,已启用日志错误等。我可以将.png转换为.jpg,所有这些都很好。

And an important note -- I was able to work with SVGs just fine for several months on this server, but I had to upgrade ImageMagick from 6.6.x to 6.7.x to get some bugs worked out in relation to text distortion. 还有一个重要说明-我可以在此服务器上使用SVG正常工作几个月,但是我不得不将ImageMagick从6.6.x升级到6.7.x,以解决一些与文本失真有关的错误。 I first tried the latest release (6.7.4-10) but couldn't get any conversion to work, so I downgraded to 6.7.4-0 and all conversions except for SVG work again. 我首先尝试了最新版本(6.7.4-10),但无法进行任何转换,因此我将其降级为6.7.4-0, 除SVG以外的所有转换都可以正常工作。 I just can't sort this one out! 我只是无法解决这个问题!

Edit: Running on Ubuntu 10.04. 编辑:在Ubuntu 10.04上运行。 Server is Litespeed 4.0.10. 服务器是Litespeed 4.0.10。

Edit 2: I have just discovered that this code -- when run from the command line ( php test.php ) -- actually does create the .png from the .svg perfectly, even though it reports "Segmentation fault". 编辑2:我刚刚发现,此代码- 从命令行( php test.php )运行时 -实际上确实从.svg创建了.png,即使它报告了“分段错误”。 Running this script from the browser does not produce any file. 从浏览器运行此脚本不会产生任何文件。

$file = 'baseball.svg';
$im = new Imagick();
$im->setBackgroundColor(new ImagickPixel('transparent'));
$im->readImage($file);
$im->setImageFormat("png32");

$fp = fopen(time() . '.png', 'w');
fwrite($fp, $im->getimageblob());
fclose($fp);

您可能没有安装实际的RSVG 二进制软件包。

I tried ImageMagick 6.7.x along with every combo of Imagick versions, no luck (always segfaults, but command line PHP is able to create the file at least) 我尝试了ImageMagick 6.7.x以及Imagick版本的每个组合,但没有运气(总是存在段错误,但是命令行PHP至少可以创建文件)

I tried ImageMagick 6.6.x along with every combo of Imagick versions, still no luck (always segfaults, command line PHP is not able to create anything). 我尝试了Imagick版本的每个组合使用ImageMagick 6.6.x,但还是没有运气(总是存在段错误,命令行PHP无法创建任何东西)。

I tried adding all required and suggested dependencies for ImageMagick, and yet, stil no luck. 我尝试为ImageMagick添加所有必需和建议的依赖项,但是,仍然没有运气。

I removed Imagick, uninstalled ImageMagick, and then ran apt-get install libmagickcore3-extra imagemagick --fix-missing . 我删除了Imagick,卸载了ImageMagick,然后运行apt-get install libmagickcore3-extra imagemagick --fix-missing Then ran pecl install imagick-3.0.1 . 然后运行pecl install imagick-3.0.1

Voila, all working as expected , but back to where I was before I attempted to upgrade ImageMagick . Voila,所有工作都按预期进行但是回到了尝试升级ImageMagick之前的状态 I cannot seem to get a self-compiled version of ImageMagick/Imagick fully working with SVGs on Ubuntu. 我似乎无法获得完全在Ubuntu上与SVG一起使用的ImageMagick / Imagick的自编译版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM