Media: Set width and height for uploaded SVGs#22244
Media: Set width and height for uploaded SVGs#22244AndyButland merged 27 commits intoumbraco:mainfrom
Conversation
|
Hi there @enkelmedia, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
AndyButland
left a comment
There was a problem hiding this comment.
Thanks for the contribution @enkelmedia - it looks a good enhancement to me, but I found a few things comment on. Mostly nits/straightforward fixes, but there are some to consider around handling non-pixel values and ensuring we are prepared for new installs.
...tructure/PropertyEditors/NotificationHandlers/SvgFileUploadMediaSavingNotificationHandler.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Infrastructure/Migrations/Upgrade/V_17_4_0/AddDimensionsToSvg.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Infrastructure/Migrations/Upgrade/V_17_4_0/AddDimensionsToSvg.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Infrastructure/Migrations/Upgrade/V_17_4_0/AddDimensionsToSvg.cs
Show resolved
Hide resolved
Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
… unit than numeric or px.
|
Thanks for all the feedback @AndyButland! I've adjusted everything according to your feedback:
Just this question left:
|
… to avoid unnecessary processing.
There was a problem hiding this comment.
This all looks good to me now @enkelmedia, and having tested out I see it working as expected. The migration completes and populates the properties on the media type, and saving an SVG populates the width and height values. A new install similarly creates the expected properties.
I made a few changes based on clean-up, extra tests, some tightening up of logic to account for edge cases. Please let me know if it looks good to you or if you see anything further for improvement. Otherwise we can merge this in.
|
Thank you very much for the polish @AndyButland! Everything looks good to me! Feel free to merge 🎉 |
Prerequisites
If there's an existing issue for this PR then this fixes #22114
Description
Following this discussion #22114 I've added a draft PR here that implements support for setting width/height on uploaded SVGs.
This PR contains:
umbracoWidthandumbracoHeightto theumbracoMediaVectorGraphicsmedia type if it exists.ISvgDimensionExtractorandSvgDimensionExtractor) including unit tests..svgfile is uploaded.