Skip to content

Add option for the original size of the image #17

@linkrb

Description

@linkrb

We should be able to pass an option to put the original size in the sizes attribute.

Example :

umanit_image_figure_lazy_load(
      image.path,
      'small_thumbnail',         
      'tiny_thumbnail',
      ['thumbnail', 'large_thumbnail'],
      'image alt',
      'img img--cover img--zoom',
      'original',    <-    pass the original size
      'class-figure',
      'Figcaption text',
      'class-figcaption',
      'low'  
    )

When the 'original' size is requested we should insert the following pattern :

sizes= "(max-width: [image width]) 100vw, [image width]"

We also need to implement security for a maximum size (When a customer uploads an image that is too big for example).

umanit_twig_image:
    use_liip_default_image: false
    class_selector: lazy
    placeholder_class_selector: lazy-placeholder
    blur_class_selector: lazy-blur
    max_size: 1600px

If an image is requested with a larger width the pattern become :

sizes= "(max-width: [image parameter max width]) 100vw, [image parameter max width]"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions