safe-svg icon indicating copy to clipboard operation
safe-svg copied to clipboard

Update how custom svg dimesions are applied

Open gabriel-glo opened this issue 1 year ago • 1 comments

Description of the Change

  • Update how custom svg dimesions are applied for get_image_tag and wp_get_attachment_image functions
  • Separate the logic for defining custom dimensions in a set_svg_dimension function

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_override and one_pixel_fix methods

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 avatar Jul 22 '24 18:07 gabriel-glo

@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?

github-actions[bot] avatar Jul 22 '24 19:07 github-actions[bot]

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

martinpl avatar Nov 27 '24 11:11 martinpl