[ACCEPTED]-How to change thumbnail src value in Dropzone.js?-dropzone.js

Accepted answer
Score: 11

This worked for me:

$('.dropzone').dropzone({
    init: function() {
        this.on('success', function(file) {
            var newname = generateServersideFilename(file.name); // this is my function
            // changing src of preview element
            file.previewElement.querySelector("img").src = newname;
        }
    }
});

dropzonejs have few examples of 1 using file.previewElement

Score: 3

This can be simply be

this.on("success", function(file) {
var mydropzone = this;
mydropzone.emit("thumbnail", file, "images/x.jpg");
});

here is the link from dropzone

0

Score: 1
this.on("addedfile", function (file) {

   file.previewElement.querySelector("img").src = "music-box-outline.svg";

});

0

More Related questions