-
Is there any way to specify the process that should run after file being uploaded? For instance I want to force jpg/png to webp format for all uploaded images with "sharp" lib, either before or during image sizes generation. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hey @chladog — good question! What I'd do is probably leave the existing jpg / png in place, but add some new fields for your Here's how I'd do it:
This could be a great plugin actually. I bet other people would have use for this as well. Does this help? I'd be happy to continue to shine some light here for you! |
Beta Was this translation helpful? Give feedback.
-
While working on this another topic arised regarding image sizes config which currently allows to set just dimensions and crop position. However it would make more sense to be able to pass full sharp.resize options. |
Beta Was this translation helpful? Give feedback.
Hey @chladog — good question!
What I'd do is probably leave the existing jpg / png in place, but add some new fields for your
webp
URLs to your upload-enabled collection. This way you still have the originals and can use them if your users' browsers are not webp-compatible.Here's how I'd do it:
afterChange
collection hookfile
from thereq
, and thereq.payloadUploadSizes
, and then convert both the main file and each of your resized versions towebp
webp
versions to disk or whereverThis could be a great plugin actually. I bet other people would have use for this as…