gpt4 book ai didi

php - Imagick SVG 到 JPG 错误无解码委托(delegate)

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:35:03 26 4
gpt4 key购买 nike

我尝试了许多不同的解决方案,但无法使用 Imagick::readImageBlob,我们将不胜感激。

错误信息:

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>

最佳答案

对我来说,这些部门不见了(ubuntu 16.04):

sudo apt-get install libgraphicsmagick1-dev libmagickcore-dev libmagickcore-6.q16-2 libmagickcore-6.q16-2-extra

预期输出:

identify -list format | grep SVG
MSVG SVG rw+ ImageMagick's own SVG internal renderer
SVG SVG rw+ Scalable Vector Graphics (RSVG 2.40.13)
SVGZ SVG rw+ Compressed Scalable Vector Graphics (RSVG 2.40.13)

关于php - Imagick SVG 到 JPG 错误无解码委托(delegate),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32948471/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com