3
私はDropzonejsプラグインを使用しています。ファイルのアップロード時に画像の大きさ(幅と高さ)とファイルサイズを確認したい。私は次元とファイルサイズを調べることができましたが、両方を組み合わせるとうまくいきませんでした。Dropzoneのチェック画像のサイズとファイルのサイズ
var maxImageWidth = 2500,
maxImageHeight = 2500;
Dropzone.options.formUserEdit = {
maxFilesize: 2,
acceptedFiles: 'image/*',
success : function(file, Response){
var obj = JSON.parse(Response);
$('#form-user-edit').append('<input type="hidden" name="userprofile" data-ori="'+file.name+'" value="'+obj.filename+'" />');
$('.error-msg').remove();
},
init: function() {
this.on("thumbnail", function(file) {
if (file.width > maxImageWidth || file.height > maxImageHeight) {
file.rejectDimensions();
else {
file.acceptDimensions();
}
})
},
accept: function(file, done) {
file.rejectDimensions = function() {
done("Please make sure the image width and height are not larger than 2500px.");
};
file.acceptDimensions = done;
}
}
場合:
は大きな寸法の画像をアップロードします。それは、小さな寸法の画像をアップロード
機能を受け入れますが、2メガバイト以上:それは
file.acceptDimensions is not a function
を返しますか、成功に行くことはありません