拇指预览中的Dropzone自定义配置类型错误

时间:2015-10-07 11:23:46

标签: dropzone.js

使用以下dropzone配置时,我会收到错误,但只有在生成缩略图时才会出现错误。

Error: TypeError: file.acceptDimensions is not a function
Source File: .../jquery.js?v=3 line 2 > eval
Line: 66

In firebug I see at line 70 the error is at Emitter.prototype.off = function(event, fn) {

标准设置正常。任何人都可以发现问题并修复我的退出区域!

var uploader = new Dropzone('#droparea', {  
previewTemplate: previewTemplate,               // preview Template
previewsContainer: "#av-dz-preview",            // container Holding html5 image previews
url: upload_url,
maxFiles:1,                                     // number of files
maxFilesize: 4,                                 // in MB
acceptedFiles: '.jpg, .gif, .png, .jpeg',       // allowed image types don't use image/*
autoQueue: false,                               // make sure the files aren't queued until manually added
addRemoveLinks: false,                          // show remove links bool
thumbnailHeight:40,                             // ds thumb preview width in px (int)
thumbnailWidth: 40,                             // dz thumb preview height in px (int)
createImageThumbnails: true,                    // show thumbnails bool
clickable: "#add-file",                         // Define the element that should be used as click trigger to select files.
init: function() {
this.on("thumbnail", function(file) {
      if (file.width < thumbW || file.height < thumbH) {
        file.rejectDimensions();
      }
      else {
        file.acceptDimensions();
      }
    });
  },
  accept: function(file, done) {
    file.acceptDimensions = done;
    file.rejectDimensions = function() { done("Image is too small"); };
  }, });

0 个答案:

没有答案