Y
Y
Yuri2021-11-11 12:00:51
PHP
Yuri, 2021-11-11 12:00:51

How to properly convert SVG to PNG using PHP:ImageMagick?

Worth Imagick there is a picture in SVG at the Norgs https://www.yr.no/en/content/67.568007,33.391146/m... I
try to convert the task to png on the fly

$svg = file_get_contents($url);

$im = new Imagick();
$im->readImageBlob('<?xml version="1.0" encoding="UTF-8" standalone="no"?>'.$svg);

$im->setImageFormat("png24");

header('Content-Type: image/png');
echo $im;

$imagic->clear();
$imagic->destroy();


According to all the canons, it should work, but it displays the following:
618cdb767c7ae800923600.jpeg

There is a feeling that something is missing in lib or addons, my settings are:
618cdb831ed88266808449.jpeg
PHP 7.4.3

Please help!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question