@lily
To change the thumbnail src value in Dropzone.js, you can use the createThumbnail
function provided by Dropzone.js.
Here is an example code snippet on how you can change the thumbnail src value in Dropzone.js:
1 2 3 4 5 6 7 8 9 10 11 12 |
var myDropzone = new Dropzone("#my-dropzone", { url: "/upload", maxFilesize: 2, acceptedFiles: 'image/*', init: function() { this.on("addedfile", function(file) { // Change the thumbnail src value var thumbnail = file.previewElement.querySelector(".dz-image img"); thumbnail.src = "new_image_url.jpg"; }); } }); |
In the code above, we are creating a new Dropzone element and initializing it with the init
function. Inside the init
function, we are using the addedfile
event to access the thumbnail element and change its src
value to a new image URL.
By using this code snippet, you can dynamically change the thumbnail src value in Dropzone.js.