Yngvarr

Generation

generate functionFri, 25 Nov 2022

svg base64 to jpg

function svg2png($string, $filename) { $encoded = base64_encode($string); $data = "data:image/svg+xml;base64,$encoded"; $image = new Imagick(); $image->readImageBlob($data); $image->setImageFormat("png24"); $image->writeImage("$filename"); }

Questions about programming?Chat with your personal AI assistant