Add Width and Height to UmbracoMediaVectorGraphics (SVG) #22114
Replies: 3 comments 5 replies
-
|
Yes, please! |
Beta Was this translation helpful? Give feedback.
-
|
Please feel free to bring a PR @enkelmedia, we'd be happy to consider it. The only thing I wonder is that it would need to be clearly applicable for all projects and all SVGs to make sense in core. For example I understand an SVG can use units like |
Beta Was this translation helpful? Give feedback.
-
|
@AndyButland nice that you think that this might make sense! You are right in that My understanding is that in a SVG like this: <svg width="800px" height="800px" viewBox="0 0 36 36" ..../>The So at the end of the day there is really no bullet proof way to get "pixels" from a SVG, but I think for the vast majority of cases something like this would be sufficient:
Would this make sense? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We just had the need to provide a aspect ratio for a UmbracoMediaVectorGraphics (SVG). I solved this by adding
umbracoWidthandumbracoHeightto the built in Media Type and added aMediaSavingNotificationHandlerthat parses the XML of the SVG to get the width and height from either width/height attributes or theviewbox.That got me thinking that maybe this could be a nice addition to the core?
Would be happy to contribute the code in a PR if this is something that we want.
Beta Was this translation helpful? Give feedback.
All reactions