Ensure we keep proper height and width settings for SVGs, unless those values don't exist #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
Previously we were setting the height and width of SVGs to be
false
, which can cause issues in certain places (like within Gutenberg) if they use those values for calculations. Instead, use the height and width values WordPress calculates for those files and if they don't exist for some reason, default those to 100, so we have a proper fallback value.Closes #18
Alternate Designs
None
Possible Drawbacks
I'm unsure of why we were setting these to
false
to begin with. The function documentation even mentions we default to 100, but as far as I can tell, that was never happening. I've tested a number of various scenarios and I've not seen any issues with using the calculated height and width instead of usingfalse
but there's potential that I missed some scenario.Verification Process
Follow the reproduction steps listed in #18 to verify the reported issue.
In addition, ensure that any SVG that gets uploaded displays correctly within the admin Media Library, within the attachment single page and when added to a Post or Page.
Checklist:
Changelog Entry
Credits