Skip to content
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

improved image sizes for left/right/center alignment #1290

Conversation

mukeshpanchal27
Copy link
Member

Summary

Fixes #1289

@mukeshpanchal27 mukeshpanchal27 added [Type] Enhancement A suggestion for improvement of an existing feature no milestone PRs that do not have a defined milestone for release [Plugin] Enhanced Responsive Images Issues for the Enhanced Responsive Images plugin labels Jun 10, 2024
@mukeshpanchal27 mukeshpanchal27 self-assigned this Jun 10, 2024
@mukeshpanchal27 mukeshpanchal27 marked this pull request as ready for review June 10, 2024 09:29
Copy link

github-actions bot commented Jun 10, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: mukeshpanchal27 <mukesh27@git.wordpress.org>
Co-authored-by: joemcgill <joemcgill@git.wordpress.org>
Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: ramiy <ramiy@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@joemcgill joemcgill linked an issue Jun 10, 2024 that may be closed by this pull request
Copy link
Member

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently blocked until #1251 is resolved, then will need to be updated based on the approach taken to fix that issue.

@mukeshpanchal27 mukeshpanchal27 changed the title improved image sizes for left/right alignment Jun 12, 2024
@mukeshpanchal27
Copy link
Member Author

@joemcgill The commit 7cbb7ae addresses center alignment.

Base automatically changed from fix/small-image-sizes to feature/more-accurate-sizes-attribute June 25, 2024 22:17
@@ -159,7 +159,7 @@ function auto_sizes_improve_image_sizes_attributes( string $content ): string {
}

// Skips second time parsing if already processed.
if ( false === $processor->get_attribute( 'data-needs-sizes-update' ) ) {
if ( null === $processor->get_attribute( 'data-needs-sizes-update' ) ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per WP_HTML_Tag_Processor::get_attribute documentation, It return null instead of false when element is not presented.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good catch.

@mukeshpanchal27
Copy link
Member Author

@joemcgill @westonruter The PR is ready for review.

Joe, In 892b0dc, I used set_up and tear_down methods to add/remove the autosizes filter and removed the individual test filters.

plugins/auto-sizes/hooks.php Outdated Show resolved Hide resolved
plugins/auto-sizes/hooks.php Outdated Show resolved Hide resolved
Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but with the tear_down not being necessary

plugins/auto-sizes/tests/test-improve-sizes.php Outdated Show resolved Hide resolved
@mukeshpanchal27 mukeshpanchal27 merged commit a305629 into feature/more-accurate-sizes-attribute Jul 3, 2024
13 checks passed
@mukeshpanchal27 mukeshpanchal27 deleted the add/left-right-alignment branch July 3, 2024 03:42
@westonruter westonruter added this to the auto-sizes 1.1.0 milestone Jul 10, 2024
@westonruter westonruter removed the no milestone PRs that do not have a defined milestone for release label Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Enhanced Responsive Images Issues for the Enhanced Responsive Images plugin [Type] Enhancement A suggestion for improvement of an existing feature
3 participants