为什么在使用PHP中的ImageMagick将SVG转换为PNG时,我会得到NoDecodeDelegateForThisImageFormat? [英] Why do I get NoDecodeDelegateForThisImageFormat when rastering SVG to PNG with ImageMagick in PHP?

查看:2383
本文介绍了为什么在使用PHP中的ImageMagick将SVG转换为PNG时,我会得到NoDecodeDelegateForThisImageFormat?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码将svg图像转换为png:

I'm trying to convert svg image to png with the following code:

$image = new Imagick();
$image->readImageBlob($_POST['svgcode']);
$image->setImageFormat("png24");
$image->resizeImage(600, 600, imagick::FILTER_LANCZOS, 1);
header('Content-type: image/png');
echo $image;

但第二行有错误:

NoDecodeDelegateForThisImageFormat `' @ error/blob.c/BlobToImage/361

我该如何解决这个问题?

How can I fix this?

推荐答案

这篇文章对我有很大帮助 http://www.elxsy.com/2009/07/安装-magemagick-on-windows-and-using-with-php-imagick /

This post helped me a lot http://www.elxsy.com/2009/07/installing-imagemagick-on-windows-and-using-with-php-imagick/

确切地说这块:


这是重要的部分,我花了半个小时试图让它工作.. grrrr ..你需要重新启动你的PC才能使库生效。

This is the important part, I spent good half an hour trying to make it work.. grrrr.. You need to restart your PC to libraries take effect.

从未为安装php扩展而这样做。

Never did this for installing php extensions.

这篇关于为什么在使用PHP中的ImageMagick将SVG转换为PNG时,我会得到NoDecodeDelegateForThisImageFormat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆