How to output exec to a variable

I have this command that converts SVG to image:

exec("convert -size 400x400 test.svg test.png", $out, $rcode);

But it works with fiels when I really need to work with DOM variables.

how to get the resulting PNG into the variable $ inst inst file (in PHP), please.

+4
source share
1 answer

This is probably what you are looking for:

<?php
$output = shell_exec("convert test.svg png:-");
echo $output;

Depending on your local setup, you may need to specify the absolute path to your utility convert. Also, the path to the file to be converted must be resolvable, again the absolute path is a safe bet first.

+1
source

Source: https://habr.com/ru/post/1606164/


All Articles