php - embedded image in svg disappear on converting svg to png -
I think that with some updates on Ubuntu, the embedded PGG image is being shown in the image converted to SVG, with the & lt; image / & gt; tag embedded PNG image).
$ svg = json_decode ($ _ POST ['svgdata']); $ Svg = '& lt ;? Xml version = "1.1" encoding = "UTF-8" standalone = "no"? & Gt; ' $ Svg; $ Im = new Imagick (); $ Success = $ im- & gt; ReadImageBlob ($ svg); $ IM- & gt; SetImageFormat ("png24"); $ IM- & gt; writeImage ('png_img / var.png'); If I resonate $ svg then gives me a correct image
While the saved image is .
For reference:
$ svg = '& lt;? Xml version = "1.0" encoding = "UTF-8" standalone = "no"? & Gt; & Lt; Svg xmlns: xlink = "http://www.w3.org/1999/xlink" style = "overflow: hidden; status: relative; -move-user-selection: text;" Xmlns = "http://www.w3.org/2000/svg" width = "794" version = "1.1" height = "122" & gt; & Lt; Image class = "barcode" style = "- moz-user-select: text;" Xlink: href = "images / 52aab69d.png" preserveAspectRatio = "none" height = "40" width = "266" y = "30" x = "380" & gt; & Lt; / Image & gt; & Lt; rect class = "ref" style = "- socks-user-selection: text;" Stroke = "# 000" full = "# 000000" ry = "0" rx = "0" r = "0" height = "18" width = "18" y = "15" x = "10" & gt; & Lt; / Rect & gt; & Lt; / Svg & gt; ';
I got the solution I had to do it completely differently. I - - gt; & Gt; .
Now when the image is embedded in SVG, PHP code successfully converts STVG to PNG image. Just changed the image path with the base64 string.
Comments
Post a Comment