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.
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
Accurate sizes: Pass parent alignment context to images #1701
Accurate sizes: Pass parent alignment context to images #1701
Changes from 1 commit
042232f
47c6779
894ed57
cf8691a
ee5f028
93d3f08
f1ec64d
2735713
b84d33e
5a9ce37
2085845
de77338
ae82ccd
8189d71
2f03e55
25d95ea
9677bca
5c6f7fd
df8741f
0790b92
8ca8b27
83be032
d3a60d0
266e457
aecb3de
7fb1962
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Good idea! I think that instead we could pass this as the function as the
$size
or$resize_width
value forauto_sizes_calculate_better_sizes()
and avoid needing to add another argument to the function signature. Alternately, we could consider allowing arbitrary values to be passed to the$max_alignment
value, which then overrides any alignment value, which may come in handy whenever we want to pass a maximum width value based on things like columns or grid values.Also, small nitpick, but this calculation isn't the same as what is used for the cover block, instead it calculates 0.5 *
$content-width
, which is a CSS variable that is defined in this package. So it should always end up being '420px'.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.
Went with the $size idea and took advantage of the fact that you can use an array for $size when passing to
wp_get_attachment_image_src()
. See, d3a60d0.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.
These were correct prior, based on https://github.com/WordPress/gutenberg/blob/938720602082dc50a1746bd2e33faa3d3a6096d4/packages/base-styles/_variables.scss#L125.