Skip to content Skip to sidebar Skip to footer

How To Upload A Smaller Version And The Original Image In Dropzone.js?

I looked at this thread: https://github.com/enyo/dropzone/issues/781 The issue is that it seems this would resize the original image and that would be the only image uploaded to th

Solution 1:

Dropzone doesn't really offer anything in regards to that. You can probably try to copy the file in the addedfile event, add some flag to it (myCopiedFile.isCopied = true;) and add it again (with this.addFile(copiedFile). Then you would need to make sure that the thumbnail isn't shown (by checking if the .isCopied flag is set), and only resize it, if the flag is set or not.

I agree with the point @robin-j made in the comment: this is something I would do on the server.

The advantages being:

  1. The user needs to upload less bytes and saves bandwidth
  2. You have more control when resizing (jpeg algorithms can be optimised to generate the smallest file size possible)
  3. You don't run the risk of users doing something funny with the data (for example: they could write a simple script, that uploads two completely different images as thumbnail and original)

Post a Comment for "How To Upload A Smaller Version And The Original Image In Dropzone.js?"