简体   繁体   English

Imagick SVG - 这种图像格式没有解码委托

[英]Imagick SVG - no decode delegate for this image format

["

I got a SVG which I have to read via readImageBlob() on the server-side.<\/i>我有一个 SVG,我必须通过服务器端的 readImageBlob() 读取它。<\/b> This works with certain SVGs, but with others I receive following http response:<\/i>这适用于某些 SVG,但对于其他 SVG,我会收到以下 http 响应:<\/b><\/p>

{"errors":[{"code":"420","status":"500","title":"Internal Server Error","detail":"no decode delegate for this image format `\u0027 @ error\/blob.c\/BlobToImage\/353","meta":{"trace":[{"file":"\/var\/www\/html\/custom\/plugins\/TextureGenerator\/src\/Service\/ImageGenerator.php","line":368,"function":"readImageBlob","class":"Imagick","type":"-\u003E"},{"file":"\/var\/www\/html\/custom\/plugins\/TextureGenerator\/src\/Service\/ImageGenerator.php","line":391,"function":"drawImage","class":"TextureGenerator\\Service\\ImageGenerator","type":"-\u003E"},{"file":"\/var\/www\/html\/custom\/plugins\/TextureGenerator\/src\/Service\/ImageGenerator.php","line":54,"function":"drawLogo","class":"TextureGenerator\\Service\\ImageGenerator","type":"-\u003E"},{"file":"\/var\/www\/html\/custom\/plugins\/TextureGenerator\/src\/Controller\/ImageController.php","line":76,"function":"generateImage","class":"TextureGenerator\\Service\\ImageGenerator","type":"-\u003E"},{"file":"\/var\/www\/html\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":156,"function":"generateTexture","class":"TextureGenerator\\Controller\\ImageController","type":"-\u003E"},{"file":"\/var\/www\/html\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":78,"function":"handleRaw","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"-\u003E"},{"file":"\/var\/www\/html\/vendor\/symfony\/http-kernel\/Kernel.php","line":199,"function":"handle","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"-\u003E"},{"file":"\/var\/www\/html\/vendor\/symfony\/http-kernel\/HttpCache\/SubRequestHandler.php","line":85,"function":"handle","class":"Symfony\\Component\\HttpKernel\\Kernel","type":"-\u003E"},{"file":"\/var\/www\/html\/vendor\/symfony\/http-kernel\/HttpCache\/HttpCache.php","line":479,"function":"handle","class":"Symfony\\Component\\HttpKernel\\HttpCache\\SubRequestHandler","type":"::"},{"file":"\/var\/www\/html\/vendor\/symfony\/http-kernel\/HttpCache\/HttpCache.php","line":452,"function":"forward","class":"Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache","type":"-\u003E"},{"file":"\/var\/www\/html\/vendor\/symfony\/http-kernel\/HttpCache\/HttpCache.php","line":346,"function":"fetch","class":"Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache","type":"-\u003E"},{"file":"\/var\/www\/html\/vendor\/symfony\/http-kernel\/HttpCache\/HttpCache.php","line":224,"function":"lookup","class":"Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache","type":"-\u003E"},{"file":"\/var\/www\/html\/vendor\/shopware\/core\/HttpKernel.php","line":178,"function":"handle","class":"Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache","type":"-\u003E"},{"file":"\/var\/www\/html\/vendor\/shopware\/core\/HttpKernel.php","line":81,"function":"doHandle","class":"Shopware\\Core\\HttpKernel","type":"-\u003E"},{"file":"\/var\/www\/html\/public\/index.php","line":77,"function":"handle","class":"Shopware\\Core\\HttpKernel","type":"-\u003E"}],"file":"\/var\/www\/html\/custom\/plugins\/TextureGenerator\/src\/Service\/ImageGenerator.php","line":368}}]}

An SVG file needs to have this at the first line: SVG 文件需要在第一行包含以下内容:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

to be properly recognized and handled by readImageBlob() .readImageBlob()正确识别和处理。

Source: readimageblob: Fatal Error when converting SVG into PNG来源: readimageblob:将 SVG 转换为 PNG 时出现致命错误

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

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