filestack / filestack-js

Official Javascript SDK for the Filestack API and content ingestion system.
https://www.filestack.com
MIT License
206 stars 81 forks source link

How to filter out formats not supported for transformation #259

Closed marcohamersma closed 5 years ago

marcohamersma commented 5 years ago

Hey there, We use the Filestack Picker to allow our users to upload images, after which we transform them (process.filestackapi.com, etc). For the picker parameters we set accept to ['image/*'], but we realised that not every type of image is accepted by filestack's image pipeline.

For example, a user recently wrote in that they were trying to upload a .jp2 image, which caused filestack to return an error when requesting the transformed image:

conv20 provider error: image/jp2 conversions are not supported (idx 0)

It would be great to have a way of automatically rejecting images supported by filestack's image processing without having to (as a user of your SDK) manually whitelist formats that you know are supported. A way of blacklisting certain formats that might otherwise be allowed by image/* would be good as an alternative.

What would you think is the best way of dealing with this?

pcholuj commented 5 years ago

Hi @marcohamersma, you can add to accept param all supported formats listed in this transformation matrix https://cdn.filestackcontent.com/UPqbkTIETnGaQJa1nqnG So:

["image/jpeg", "image/jpeg", "image/png", "image/webp", "image/xvg+xml", "image/heic", "image/heif", "image/bmp", "image/tiff", "image/photoshop", "image/psd", "image/x-psd", "image/vnd.adobe.photoshop"]
pcholuj commented 5 years ago

@marcohamersma if something is not clear, just reopen the issue. Thanks :)

septianopraditya commented 4 years ago

I have same issue here. Like this pic image