You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For simple use cases this is sufficient but these days we'd want to be delivering different image formats depending on the support in the users browser. With the current implementation of eager loading it isn't possible to eager load multiple "base" transforms so if you want to serve multiple formats you end back up in a situation where you have to make lots of database queries, at least I can't see a way, I may be wrong.
It would be great if Craft would provide a way to specify multiple transforms. To remain backwards compatible with the current image transform and eager loading mechanisms I could see this being added via a andWithTransforms method in a similar vain to the relatedTo chaining added with andRelatedTo.
I'm not sure if the proposed solution and do image.setTransform(transformJpeg) and passing an override via the second argument in getSrcset could create any issues, or if the do statement is even required?
There are other discussions open about this #8862 but I think this one is better focused and better illustrates the use case and a possible route forward. Disclaimer that discussion was opened by my agency but felt this was better addressed in a new discussion.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently Craft allows eager loading of image transforms to reduce database queries but only allows for one "base" transform.
For simple use cases this is sufficient but these days we'd want to be delivering different image formats depending on the support in the users browser. With the current implementation of eager loading it isn't possible to eager load multiple "base" transforms so if you want to serve multiple formats you end back up in a situation where you have to make lots of database queries, at least I can't see a way, I may be wrong.
It would be great if Craft would provide a way to specify multiple transforms. To remain backwards compatible with the current image transform and eager loading mechanisms I could see this being added via a
andWithTransforms
method in a similar vain to therelatedTo
chaining added withandRelatedTo
.I'm not sure if the proposed solution and
do image.setTransform(transformJpeg)
and passing an override via the second argument ingetSrcset
could create any issues, or if thedo
statement is even required?There are other discussions open about this #8862 but I think this one is better focused and better illustrates the use case and a possible route forward. Disclaimer that discussion was opened by my agency but felt this was better addressed in a new discussion.
Beta Was this translation helpful? Give feedback.
All reactions