php how to get width and height of a svg picture? I tried to use
Scalable Vector Graphics
chrome's Review elements
The thing is: SVG images don't have a "size" in the sense you are probably thinking of. On the other hand, they DO have a height-to-width ratio.
This ratio can usually be found in the
If, on the other hand, the
viewBox attribute is not present on the root SVG element, the image ratio is highly nontrivial to determine.
Side note: The reason Chrome gives you perfect coordinates isn't necessarily because it looks at the SVG to determine size; it could very well be a simple result of it setting the size.
Although the SVG element does have
width attributes, these might not be specified as pixels, but any of a number of units, so they aren't necessarily a lot of help.