-
Notifications
You must be signed in to change notification settings - Fork 12
Support for srcset, data URIs and individual placeholder images #7
base: master
Are you sure you want to change the base?
Conversation
- Pass matches to lazyload_images_placeholder_image filter allowing it to generate individually sized images - Allow data:image placeholder URLs - Removed .hide() flickering - Added css/noscript to head so only one image appears w/o JavaScript enabled
// Remove src, lazy-src, srcset, lazy-srcset, sizes and data-lazy-sizes since we manually add them | ||
$new_attributes = $old_attributes; | ||
$css_class = $new_attributes['class'] ? $new_attributes['class']['value'].' lazy' : 'lazy'; | ||
unset( $new_attributes['src'], $new_attributes['data-lazy-src'], $new_attributes['srcset'], $new_attributes['data-lazy-srcset'], $new_attributes['sizes'], $new_attributes['data-lazy-sizes'], $new_attributes['class'] ); |
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.
The indentation should be fixed here (should be using tabs, not spaces).
Thanks @deas! I left some feedback on the code. |
Is this going to be merged with the |
I see that this push has been in limbo for a while. Are there any plans to merge the branch with the production code? I was looking at @mjangda's comments, and I think the function
Regarding @deas's comment, it is okay if |
This PR introduces
$matches
tolazyload_images_placeholder_image
filter allowing it to generate individually sized placeholders