Update how custom svg dimesions are applied
Description of the Change
- Update how custom svg dimesions are applied for
get_image_tagandwp_get_attachment_imagefunctions - Separate the logic for defining custom dimensions in a
set_svg_dimensionfunction
Closes #6
How to test the Change
In any template output the image markup either by using get_image_tag or wp_get_attachment_image functions.
Set the custom image size to either one of the registered image size names or a custom one via array [$width, $height].
Output should match the set dimensions.
Changelog Entry
Added - added set_svg_dimension function in order to reduce repetition Changed - changed how image dimensions were passed in
get_image_tag_overrideandone_pixel_fixmethods
Credits
Props @
Checklist:
- [x] I agree to follow this project's Code of Conduct.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my change.
- [x] All new and existing tests pass.
@gabriel-glo thanks for the PR! Could you please fill out the PR template with description, changelog, and credits information so that we can properly review and merge this?
This breaks behavior in wp_get_attachment_image(): before: any thumbnail size will inherit SVG width, height attributes now: only 'full' thumbnail will inherit SVG width, height attributes
Reverting this helps: https://github.com/10up/safe-svg/pull/216/files#diff-05bf19b873cfb6358cd7c239366db6675635bf4b03a4b56353102e359d5c2859L447