Graphql srcset does not except format argument in the same way url does as you'd expect. #10299
-
DescriptionI need to create webp versions of my asset URLs and srcsets generated in graphql. adding format to URL
I have tried to do this, but even if this approach would work it would be long winded and require repeating my srcset multiple times...
Additional infoPHP version 8.0.12 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
It's meant to serve as a reference at this point, though, as GraphQL is self-documenting. You should be able to find all the available information using the built-int GraphiQL IDE. If you check there, you'll see the As for your specific case, you can get away with using {
entries {
... on someEntryType {
# This part is relevant
imageWebp: assetField @transform(format: "webp") {
...defaultImageData
url @transform(width: 300, format: "webp")
}
assetField {
...defaultImageData
url @transform(width: 300)
}
# End relevant part
}
}
}
# Well the fragment is relevant, too
fragment defaultImageData on AssetInterface {
title
width
height
srcset(sizes: ["300","600", "960", "1200"])
} Does that make sense? |
Beta Was this translation helpful? Give feedback.
-
Craft 4.0.5 is now out with the fix for this (#11413). |
Beta Was this translation helpful? Give feedback.
Craft 4.0.5 is now out with the fix for this (#11413).