Closed bobevsky closed 1 year ago
When you are referencing file size, does that mean it is the total size of the string length?
Can you upload a sample output?
@ncla yes, the size of the NEXT_DATA actually which is the size of the entire page (reference)
I am uploading the 3 files for the 3 scenarios:
data with srcSetWebp and placeholder data-with-placeholder-and-srcSetWebp.txt
data with srcSetWebp and NO placeholder data-with-srcSetWebp-only.txt
data with no images at all data-without-images.txt
I checked out the first file and it looks like it is working as intended. Yeah, JSON might be quite big but you have multiple usages of responsive images in the page builder.
Placeholder images are inlined as a string which naturally takes space.
Then there are the multiple widths generated that you may or may not need in such high resolutions. You have such widths such as 2882px wide, the maximum is determined by the original asset dimensions. You can set a maximum generated width cap with glide:width
parameter. https://github.com/spatie/statamic-responsive-images#glide-parameters Maybe that helps bring down the total size even more.
Closing this issue as this is not really a bug.
You might see some additional total string reduction in future. I figured that we are passing widths and heights to Glide with float numbers, when Glide and pixels only work in integer values (you can pass floats, but it will force converted to integer in Glide). So values like 233.88235294118
would become 234
. This will cleanup the output significantly.
Bug description
I tested out the GraphQL plugin and found out that the srcSetWebp / srcSet / placeholder are producing way too much data.
Consider these scenarios:
Now, all of my projects are with headless CMS and Nextjs and for them to be loaded with images it's extremely slow sometimes.
All of that data is because the long characters that srcSetWebp / srcSet / placeholder are generating. What can we do about that?
How to reproduce
Just execute 1 graphQL query on any image using the srcSetWebp / srcSet / placeholder and you will get extremely long strings which produce way too much data.
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Antlers Parser
regex (default)
Additional details
No response