Hi, I've used your plugin recently and I had a great experience so far! I've noticed that, while uploading the imageSizes works great, Payload's API would return the local domain instead of the S3 URL (for the sizes only).
I didn't find a good solution with the hook configured on a field level. Even if the correct URL is stored in the database for a particular size, say with the help of a beforeChange hook, the url property would still be overridden on API requests.
I've found the best way to deal with this behavior is to apply the afterRead hook on the collection level instead. So here's my implemention, maybe that can be helpful to others?
Hi, I've used your plugin recently and I had a great experience so far! I've noticed that, while uploading the imageSizes works great, Payload's API would return the local domain instead of the S3 URL (for the sizes only).
I didn't find a good solution with the hook configured on a field level. Even if the correct URL is stored in the database for a particular size, say with the help of a
beforeChange
hook, theurl
property would still be overridden on API requests.I've found the best way to deal with this behavior is to apply the
afterRead
hook on the collection level instead. So here's my implemention, maybe that can be helpful to others?