Imagick SVG到JPG错误没有解码委托 [英] Imagick SVG to JPG error no decode delegate
本文介绍了Imagick SVG到JPG错误没有解码委托的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试了许多不同的解决方案,但是不能使用Imagick :: readImageBlob,将不胜感激.
I have tried many different solutions, but cannot use Imagick::readImageBlob, any help would be appreciated.
错误消息:
Caught exception: no decode delegate for this image format `' @ error/blob.c/BlobToImage/364
代码:
$svg = file_get_contents($this->svg);
$image = new Imagick();
$image->readImageBlob($svg);
//...
SVG:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" version="1.1" width="928" height="933" id="parent">
<image width="928" height="933" xlink:href="image.jpg" ></image>
<path id="path1" fill="none" d="M100,656.5c-105.1-200.5-28.1-448,172-553s447.5-27.5,552.6,173s28.1,448-172,553 S205.1,856.9,100,656.5z"/>
<text text-anchor="middle">
<textPath xlink:href="#path1" startOffset="33.3333%">
<tspan>top</tspan>
</textPath>
</text>
<path id="path2" fill="none" d="M121.8,264.8C10.2,453.3,72.2,696.3,260.3,807.7s431,48.9,542.6-139.5 s49.5-431.5-138.5-542.8S233.3,76.4,121.8,264.8z"/>
<text text-anchor="middle">
<textPath xlink:href="#path2" startOffset="33.3333%">
<tspan>bund</tspan></textPath>
</text>
</svg>
推荐答案
由@Native Coder和@karser尝试后,我的SVG仍生成相同的no解码委托错误.在我添加<?xml version="1.0" encoding="UTF-8" standalone="no"?>
作为SVG内容的开始行之后,它起作用了.值得检查您的XML是否也有效.
After having tried by @Native Coder and @karser answers my SVG was still generating the same no decode delegate error. It worked after I added <?xml version="1.0" encoding="UTF-8" standalone="no"?>
as the opening line of my SVG content. Worth checking your XML is valid as well.
这篇关于Imagick SVG到JPG错误没有解码委托的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文