-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update how custom svg dimesions are applied #216
Conversation
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
@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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the PR @gabriel-glo. Code looks good and it tests well. (Added one minor doc update suggestion)
@dkotter The PR looks good to me. However, since we had 2-3 size/dimension-related PRs on this plugin earlier and you have better context on those, I wanted to have a quick review from your side to ensure these changes align with those PRs.
Thank you.
Co-authored-by: Darin Kotter <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me now. Tested with both get_image_tag
and wp_get_attachment_image
and verified things worked as expected with both. Testing on the latest release and on this PR, get_image_tag
returns the exact same output. Testing wp_get_attachment_image
, on the latest release, if you pass in an array of sizes, those values aren't being used. On this PR, those sizes are now respected and set properly as the height and width attributes.
This breaks behavior in wp_get_attachment_image(): Reverting this helps: |
Description of the Change
get_image_tag
andwp_get_attachment_image
functionsset_svg_dimension
functionCloses #6
How to test the Change
In any template output the image markup either by using
get_image_tag
orwp_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
Credits
Props @gabriel-glo, @jeremymoore, @iamdharmesh, @dkotter
Checklist: