We are safe to use the new release of Blazy, after the hook updates

I'm testing heavily as Lazy loading + Blur effect is the trend these days.
We can find this in almost all pages on the internet.

Using the current way of blur image - get the original shape for the placeholder image.
But in many cases, another shape may get used

For Example:

The Current Blazy DEV work as follows - loading the original uploaded shape
Chrome_ Blazy DEV - Media Blocks

But what needed is to have the place holder image in the same shape as the current needed responsive Image style
Chrome_ Varbase Media - Blazy DEV - Media Blocks

square 1:1, circle 1:1, or other sizes like 4:1

https://www.youtube.com/watch?v=xbMClT-x_g8

#3107324: Add support for latest blazy loading new logic on responsive image styles

Comments

RajabNatshah created an issue. See original summary.

rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

gausarts’s picture

Status: Active » Postponed (maintainer needs more info)
StatusFileSize
new1.67 MB

There is Aspect ratio option named Fluid (auto sounds a better name, Fluid was taken from Fluid layout). It was meant for the deprecated custom multi-breakpoints image (#3105243: Shall we keep or drop custom breakpoints? Your vote counts) like Responsive Image, but output as IMG with SRCSET, not PICTURE.

Please clarify:

  1. Are you using the provided option Aspect ratio as seen in the attached screenshot individually for each image? There are few options like seen in your screenshot: 1:1, 4:, 16:9, etc. If you do, you won't see the abrupt change from small to large like in that.
  2. Does Fluid Aspect ratio work with non-PICTURE at your end? FYI, Aspect ratio with irregular sizes for picture is not working, yet.

Any improvement is very much welcome to the current limitation, of course.

Not related to your screenshots. As I saw you put images in grids, I just noticed there is a regression from RC3 for when any grid value is set to 1, likely for mobile version:
https://git.drupalcode.org/project/blazy/blob/8.x-2.x/src/BlazyGrid.php#L95
It should remove the condition that says && $settings['grid_' . $grid] > 1:

  if (!empty($settings['grid_' . $grid]) && $settings['grid_' . $grid] > 1) {
    $attributes['class'][] = $grid . '-block-' . $style . '-' . $settings['grid_' . $grid];
  }

Should be like RC3 without that condition:
https://git.drupalcode.org/project/blazy/blob/8.x-2.0-rc3/src/BlazyGrid....

  if (!empty($settings['grid_' . $grid])) {
    $attributes['class'][] = $grid . '-block-' . $style . '-' . $settings['grid_' . $grid];
  }  

Will provide a fix for this tonight, or so.

rajab natshah’s picture

Issue summary: View changes

Noted; On your time.

Thanks a lot, Gaus!! :)

We are safe to use the new release of Blazy, after the hook updates

I'm testing heavily as Lazy loading + Blur effect is the trend these days.
We can find this in almost all pages on the internet.

I have noticed the following:

The Responsive image 1px placeholder

By default a 1px Data URI image is the placeholder for lazyloaded Responsive image. Useful to perform a lot better. Uncheck to disable, and use Drupal-managed smallest/fallback image style instead. Be sure to add proper dimensions or at least min-height/min-width via CSS accordingly to avoid layout reflow, or choose an Aspect ratio via Blazy formatters. Disabling this will result in downloading fallback image as well for non-PICTURE element (double downloads).

will load with the Image effect

Choose the image effect. Note! This will override Placeholder option. Will use Thumbnail style option at Blazy formatters for the placeholder with fallback to core Thumbnail style. For best results: use similar aspect ratio for both Thumbnail and Image styles; adjust Offset and or threshold; the smaller the better. Use hook_blazy_image_effects_alter() to add more effects -- curtain, fractal, slice, whatever. Limitations: Currently only works with a proper Aspect ratio as otherwise collapsed image. Be sure to add one. If not, add regular CSS width: 100% to the blurred image if doable with your design.

If we have the Responsive image 1px placeholder + Image effect it will load them both
is it logical when we select Image effect to ignore the 1px placeholder?
Not very sure that it's overriding at this time

Thanks a lot for working in all-new improvements

I will test converting our custom effect to use hook_blazy_image_effects_alter()

rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Yes, I'm using many different shapes + different grid arrangements using views bootstrap + Responsive Image styles

I'm testing with https://github.com/vardot/varbase_vmi_demo

Updated the full testing cases - after your latest changes.

dev---varbase8c1blazy--2020-02-03_21-52-23.tar.gz
dev---varbase8c1blazy--2020-02-03_21-52-23-db.sql.tar.gz

I have updated my site to your latest dev for real data example
http://rajab.natshah.com

gausarts’s picture

Thank you for giving the latest Blazy a whirl, Rajab. Truly appreciated.

If we have the Responsive image 1px placeholder + Image effect it will load them both
is it logical when we select Image effect to ignore the 1px placeholder?
Not very sure that it's overriding at this time

AFAIK, both uses the same SRC attribute, and the image effect is set to win. Having them both with says one, hence image effect, stored in a data attribute might need some extra work, which I can't afford for now. Aside from the fact that the image for effects can be very small below 50px. However patches are very much welcome. Thanks.

Aspect ratio with irregular sizes for picture is not working, yet.

I have added a temp fix for this with the latest commit today, so Aspect ratio Fluid should "work" with both Picture and regular Responsive image now, hopefully. I haven't thoroughly tested the fix against various setups so I might still miss anything.

The latest fix also makes it possible to embed Blazy (specifically related to the troublesome Aspect ratio Fluid which was previously broken) outside blazy-related plugins, hence without Blazy container, such Views Bootstrap, etc. The regular Views gotcha applies, checking or unchecking Use field template is normally the solution.

I am still working out few more TODOs before releasing a new RC, hopefully next week, if not sooner.

gausarts’s picture

Status: Postponed (maintainer needs more info) » Fixed

The Fluid or auto aspect ratio had been really tough works this far. It appears to work correctly in the past few releases, though. Not perfect due to Picture nature is different from regular Responsive image. Just works.

Closing this, unless anything else to do here. Thanks.

rajab natshah’s picture

Noted; thank you Gaus for all your work on Blazy.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.