Closed jordanch closed 5 years ago
Hi, I can take a look. It uses the storage.getURL()
method internally, so might be as easy as making sure the size
option is passed through to that method. Will let you know.
https://github.com/flamelink/flamelink-js-sdk/pull/42 should hopefully take care of this. It will be available in the next alpha release.
First of all, is this already in the 1.0.0-alpha.11
version. If so, how would I enable the sized URLs to appear in a get request?
A single sized URL is available in the latest alpha release, but not multiple sizes.
To specify a specific size for the URL to retrieve you can use the following populate
syntax:
app.content.get({
schemaKey: 'someSchema',
populate: [
{
field: 'someImage',
size: {
width: 1024,
height: 9999,
quality: 0.75
}
}
]
});
Does this also work with a specific EntryID ?
const response = await app.content.get({
schemaKey: "content",
entryId: id,
populate: [
{
field: "images",
size: {
width: 375,
height: 9999,
quality: 1
}
}
]
})
This should work with an entryId
as well.
Hi, sorry again. Somehow I can not manage to populate the right size. Populating works but not with the size. I don't know if I have something wrong or not ... (I did not change anything in the flamelink settings for the sizes)
try {
const response = await app.content.get({
schemaKey: "article",
entryId: id,
populate: [
{
field: "banner",
size: {
width: 1080,
height: 9999,
quality: 1
}
},
{
field: "images",
size: {
width: 375,
height: 9999,
quality: 1
}
}
]
})
console.log(response)
...
It returns the right Object of the given ID but the images urls are not sized accordingly to the given sizes. The "banner" and "images" are media fields in flamelink. I have tried only using one field, adding path to the size object and also setting quality to 1 or 1.0.
I am using:
"firebase": "^6.2.0",
"flamelink": "^1.0.0-alpha.19",
Can you try with quality: 100
?
Hi, it still returns me the wrong image size.
You were right the quality
should be 1
and not 100
. Can you test again with 1.0.0-alpha.20
?
HI,
thanks for the answer.
After updating to 1.0.0-alpha.21
it works now.
Awesome, thanks for confirming.
I'm on alpha.28 and the resizing is not working for me, only the first one works, all others return the original image size
populating content with relational media data returns a single url for a single image size, could relational populate for media fields work similarly to
storage.getURL()
doc where an optionsize: 'device'
returns a device-size-relative image or have an object map of sizes to URLs?Thanks