Skip to content

Instantly share code, notes, and snippets.

@nqphuong
Last active June 17, 2017 09:20
Show Gist options
  • Save nqphuong/8acaf71979e7afe406bd to your computer and use it in GitHub Desktop.
Save nqphuong/8acaf71979e7afe406bd to your computer and use it in GitHub Desktop.
//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...
};
}
});
@nqphuong
Copy link
Author

nqphuong commented Apr 6, 2016

test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment