Okay
  Public Ticket #2385829
twig for img srcset
Closed

Comments

  • jk started the conversation

    is it somehow possible to get a full srcset when using {{item.image_width}} ?

  •   Max replied privately
  • jk replied

    when i use 

    <img width="{{item.image_width}}" height="{{item.image_height}}" src="{{item.image}}">
    

    i get this in compiled code:

    <img width="1200" height="800" src="path/to/image.jpg">
    

    but i would like to get a scrset like:

    <img width="693" height="693" 
        src="   path/to/image.jpg" srcset="path/to/image.jpg 693w, 
                path/to/image-300x300.jpg 300w, 
                path/to/image-150x150.jpg 150w" 
        sizes="(max-width: 693px) 100vw, 693px">
    

    to deliver different image sizes to different devices...

  •   Max replied privately