Last active
June 17, 2017 09:20
-
-
Save nqphuong/8acaf71979e7afe406bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create dropzone instance with some attributes | |
var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone | |
url: siteurl// Url to process images uploaded. | |
thumbnailWidth: 80, | |
thumbnailHeight: 80, | |
parallelUploads: 20, | |
previewTemplate: previewTemplate, | |
autoQueue: true, // Queue all files selected. It need to upload image. | |
previewsContainer: "#previews", // Define the container to display the previews. | |
clickable: ".fileinput-button", // Define the element that should be used as click trigger to select files. | |
acceptedFiles: ".jpeg, .jpg, .png, .JPEG, .JPG, .PNG", //Filter images based on image extension. | |
init: function(){ | |
//Verify thumbnail version for each image selected | |
this.on("thumbnail", function(file) { | |
//Reject image if image width < MIN_WIDTH | |
if (file.width < MIN_WIDTH) { | |
file.rejectImages(); | |
} else { | |
file.acceptImages(); | |
} | |
}); | |
}, | |
accept: function(file, done){ | |
file.acceptImages = function(){ | |
//Your process... | |
done(); | |
}; | |
file.rejectImages = function(){ | |
//Your process... | |
}; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
test