I am using an image field in one of my collection types and would like to pull just the data for just one of the format sizes but am unable to do this. I am using a JavaScript query with the qs
library.
The following successfully pulls in all the formats:
const params = {
sort: ['title:asc'],
filters: {
title: {
$eq: 'Blah'
}
},
fields: ['title'],
populate: ['image']
};
Looking at the docs I thought that this should work and just get data for the small format, but it return all the format sizes:
const params = {
sort: ['title:asc'],
filters: {
title: {
$eq: 'Blah'
}
},
fields: ['title'],
populate: {
image: {
populate: {
formats: ['small']
}
}
}
};
Any suggestions would be greatly appreciated.
Edit - ChatGPT suggested this, but it didn’t work either unfortunately:
populate: {
'image.formats.medium': {
select: ['url', 'width', 'height', 'size']
}
}