1

次のように、imagick read svg text に関する問題が発生しています。

$xmlDoc = new DOMDocument();
$svgroot = $xmlDoc->createElement('svg');
$textnode = $xmlDoc->createElement('text');
$textnode->setAttribute('font-size','24');
$textnode->setAttribute('transform','matrix(3.1054,0,0,3.1054,158.5,0)');
$textnode->setAttribute('font-family','helvetica');
$textnode->appendChild($xmlDoc->createTextNode("eeee"));

$textnode = $svgroot->appendChild($textnode);
$xmlDoc->appendChild($svgroot);

$svgtext = new Imagick();
$svgtext->setbackgroundcolor('#00000000');

$svgtext->readImageBlob($xmlDoc->saveXML());

readImageBlob 関数の最後の行で例外がスローされます (「helvetica」フォントは既に windows/fonts にインストールされています)。それは言います:

  Uncaught exception 'ImagickException' with message 'must specify image size `C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/1/magick-270886DDFFPHkGTr' @ error/mvg.c/ReadMVGImage/185' in C:\xampp\htdocs\opencart\imagicktest.php:106 Stack trace: #0 C:\xampp\htdocs\opencart\imagicktest.php(106): Imagick->readimageblob('<?xml version="...') #1 {main} thrown in C:\xampp\htdocs\opencart\imagicktest.php on line 106

このバグは Windows Server 2003 でのみ発生します。winXP で imageMagic を実行すると、この例外は発生しません。このバグはhttps://bugzilla.redhat.com/show_bug.cgi?id=193474と似ていると思います

windows2003 は imagick render svg フォントをサポートするために何かをインストールする必要がありますか?

4

1 に答える 1

-1

画像サイズ属性がルート要素ImagickExceptionから欠落しているため、がスローされます。svg異なるバージョンのImageMagick&SVGシステムライブラリは、あなたが経験する振る舞いに貢献するでしょう。viewBoxこれを修正するには、、、、xy属性を使用して画像のサイズを指定するだけです。

$xmlDoc = new DOMDocument();
$svgroot = $xmlDoc->createElement('svg');
$svgroot->setAttribute('viewBox','0 0 60 24'); // Set the viewable canvas
$svgroot->setAttribute('x',0);                 // Left offset
$svgroot->setAttribute('y',16);                // Top offset 
$svgroot->setAttribute('width',60);            // Optional rendering width
$svgroot->setAttribute('hieght',24);           // Optional rendering height
于 2013-02-26T14:35:04.400 に答える