Search code examples
filepicker.io

how to convert images on upload without a second call to convert


I am trying to figure out how to convert something on upload. Is there a "save as" option to be passed by so i can set "png" as the only format to be saved on the other side? The user still can use all image formats but i dont have to make the second step to convert everything to the right format and size?


Solution

  • the answer i got via email support.

    Hi there - happy to help. The best way to do this is to "chain" the .pick() and .convert() calls, like so:

    filepicker.pick(function(fpfile){ filepicker.convert(fpfile, {...}, function(stored_fpfile) { ... } }

    This way the conversion can be done in the background while the user moves on to another step