This question already has an answer here:
- Convert SVG image to PNG with PHP 10 answers
I've googled as much as I can, but I've only found a PHP class that calls upon Inkscape to render the SVG, so I ask here:
I have a valid SVG file generated in some way (or uploaded by a client). I need to render this into a JPG or PNG using just PHP and/or GDLib, as SVG is not supported by all browsers.
I do not have the option of installing anything, so a class that converts SVG to PNG using GDLib would be the most ideal.
Check if ImageMagick is installed (you can find out using
phpinfo
). If it is, you can use the following code to cover to a PNG.There are many threads that discuss this. One that is particularly useful is this thread: Convert SVG image to PNG with PHP