Q. Is there/can we have an option for inline_preview_images to target/count only JPEG images (e.g. by regex)?
We don't currently have an option like this, but it's something we could consider. I'd like to understand the motivation though. Is there an issue inlining other image types?
Our sites usually start with a few small (PNG, GIF, spacer) graphics and then one or more larger JPEGs in the content area. To avoid inlining the small graphics we use ModPagespeedMinImageSizeLowResolutionBytes, but then ModPagespeedMaxInlinedPreviewImagesIndex still needs to be large enough to count all the small graphics, which varies between websites.
What we'd like to be able to do is either:
- inline the first n images larger than ModPagespeedMinImageSizeLowResolutionBytes; or
- inline the first n images matching *.jpg or */large/* similar regex.
Q. Can we use lazyload_images without also having to optimise images and/add them to the cache?
Lazyload should be independent of other image optimizations. You can disable the rewrite_images filter and just enable lazyload. You can test this by adding ?ModPagespeedFilters=lazyload_images query param to an MPS enabled site, which will only enable the lazyload filter.
On one of our servers we have disabled image rewriting at the global level:
ModPagespeedInheritVHostConfig on
ModPagespeedDisableFilters rewrite_images,recompress_images,recompress_jpeg
ModPagespeedDisallow *.jpg*
ModPagespeedDisallow *.JPG
ModPagespeedDisallow *.jpeg
ModPagespeedDisallow *.gif*
and then just for a couple of virtual hosts enable lazyload_images:
ModPagespeedEnableFilters lazyload_images
ModPagespeedLazyloadImagesBlankUrl "/spacer.gif"
For those vhosts we immediately see optimised JPEG images appearing in the cache and on the website.
Thanks again for testing!