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

Fallback - Add original image and height attribute #7

Closed
linkrb opened this issue Jan 26, 2021 · 1 comment
Closed

Fallback - Add original image and height attribute #7

linkrb opened this issue Jan 26, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@linkrb
Copy link
Collaborator

linkrb commented Jan 26, 2021

To avoid the Cumulative Layout Shift we should add the image and height attribute.

When we use the thumbnail it's ok. We take the height define in the filter

            filters:
                # use and setup the "thumbnail" filter
                thumbnail:
                    # set the thumbnail size to "32x32" pixels
                    size: [32, 32]

But with the relative filter we can't determinate the height of the image.

        big_filter:
            filters:
                relative_resize:
                    widen: 735

If we have only one dimension. We need to push the height and width of the original image
With that the browser manages to determine the ratio of the image.

An idea -> with the data_root and the path of the image we can retrieve the width and height.

getimagesize($this->data_root.$path)[3];

@linkrb linkrb added the enhancement New feature or request label Jan 26, 2021
@DjLeChuck
Copy link
Member

DjLeChuck commented Apr 2, 2021

Fix with v1.0.7 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants