DropzoneJs 5.5 & Thumbnail Problems

Category:

By

/

read

DropzoneJs is a very good JavaScript upload script and flexible.

Too bad, upgrade is something a bit tricky and make existing script not work.  Well I would not complain if there is a good document, but there is not.

Problem with thumbnail not display when retrieve existing file. It used to be function createThumbnailFromUrl.  The parameter has changed so this solution does work

dz is your Dropzone object. The key is to have dataURL set on your file.

var thumb = { name: filename, size: 0, dataURL: ‘/upload-directory/’ + ‘filename’ };
dz.files.push(thumb);

// Call the default addedfile event handler
dz.emit(‘addedfile’, thumb);

dz.createThumbnailFromUrl(thumb,
dz.options.thumbnailWidth, dz.options.thumbnailHeight,
dz.options.thumbnailMethod, true, function (thumbnail) {
dz.emit(‘thumbnail’, thumb, thumbnail);
});

// Make sure that there is no progress bar, etc…
dz.emit(‘complete’, thumb);

Leave a Reply