I tried some things yesterday but they didn’t work. Can’t think of a workaround for the moment apart from creating a custom file method that does the same we would’ve done to create the srcset before the srcset method was introduced.
Need the same thing. There are always images, that need to be cropped. One possible solution is to use css object-fit: cover css property for image. This way you can “cut” image without actually cutting it. Con is that you have bigger file size, than you could, if it was actually cut, but on the other hand, if you resize image with srcset, it’s still smaller.
I guess you could potentially use a file upload hook to duplicate the image, crop it as part of the dupe and store it in the content folder, then do your srcset from that file? That way it will be an image in its own right, rather then a thumb.
Not quite as slick, but might do until support for this is built in.
Then I’ll add up with hooks-spaghetti and duplicated files which I should keep in sync somehow too (again with hooks?)? Also for editors it would be confusing to have 2 images pop up (seamingly random) for them, just because I would be able to chain srcset() after crop()?
I think currently your best option is to set up your array of source sizes and then loop through that array to render your srcset using crop on the original image. The height can be calculated from the ratio between width and height.
I’d probably create a custom method that adapts the srcset method for cropped images, i.e. using crop() instead of resize().
Mid priority doesn’t mean it can’t land in 3.2, it’s all still pretty much in flux. However, the reason that it is only mid priority is probably that the missing options are not really a show-stopper but rather “nice to have”.