Is it planned to add srcset for this next release?

Are there plans for img srcset to be part of elements (or the image element) and also when adding images using the native media button for the Text element RTF view?

1 Like

Hi @wbgTHEMECO,

We’ve still not made the call on how we want to approach this. I think the first step we will take (possibly in this update) is making new images link to the media attachment ID instead of the URL. This will provide better integration with how WordPress handles srcset natively.

This is great, as long as the retina function works in all cases, to keep the images sharp. Personally, I don’t want WordPress to load a smaller image on mobile and make it blurry in the process. :slight_smile: I’d rather optimize on the source and upload controlled image sizes.

1 Like

Right, we’d definitely need to work out the retina math there. So the challenge with the current retina option is that it requires knowing the image dimensions in advanced. This is actually somewhat difficult to do, and the current method involves introspecting the image right after you choose it in the Image uploader. If you use the new dev console, you can see that there are height and width values being stored in the Image element (and other elements with images). We halve those values if the retina option is ticked. Fortunately, WordPress stores the image dimensions in meta data, so we should be able to grab those and always output the image at half the size so it retains pixel density when being displayed.

1 Like

Update: A few things regarding this taking effect in the next patch…

Image Management

  • Images can now be stored and managed as attachment IDs or URLs
  • By default, all images added via the media library are stored by attachment ID
  • The retina feature works exactly as before, but gets the dimensions from the stored meta data instead of introspecting the image in the builder

Srcset Support

  • We haven’t decided yet which strategy we’re going to commit to for srcset support, but the next beta will allow testing an implementation if you simply turn retina off on any image.
  • We do not find it advantageous to reinvent the wheel and make our own version of managing all the different breakpoints and image sizes, so whatever final result we use will use the built in WordPress functionality.
  • Because we have access to the attachment ID, we can tap into the WordPress management of srcset and sizes attributes.
  • The final implementation could involve another control that lets you choose between Retina and Srcset, or simply let you toggle them independently. We just need to do some more testing and experimentation to see if both can realistically coexist at the same time.
3 Likes