我正在尝试以下方法:
https://jsfiddle.net/zgaxy70t/1/
然而,看起来设置没有被尊重。如何在调用unsigned_cloudinary_upload
?
$('.upload_field').unsigned_cloudinary_upload(preset_name, {
cloud_name: 'cloudname',
disableImageResize: false,
imageMaxWidth: 2000, // 800 is an example value
imageMaxHeight: 2000, // 600 is an example value
maxFileSize: 8000000, // 20MB is an example value
//loadImageMaxFileSize: 200000, // default is 10MB
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|bmp|ico)$/i
}, {
multiple: true
})
我也试过这个:
//{
// cloud_name: 'test',
// max_files: settings.maxFiles,
// tags: tags,
// client_allowed_formats: ["png", "gif", "jpeg", "jpg", "jpe", "jpc", "jp2", "j2k", "wdp", "jxr", "hdp", "webp", "bmp", "tif", "tiff", "ico", "ps", "ept", "eps", "eps3", "psd", "svg", "ai", "djvu", "flif", "tga"],
// max_file_size: 8000000
//},
答案 0 :(得分:0)
目前,无法使用unsigned_cloudinary_upload
方法并限制客户端允许的格式,最大文件数,最大文件大小。
一个紧密的解决方法是使用cloudinary_fileupload
方法让上传无符号。这将允许您设置最大文件大小,并使用正则表达式来限制文件类型。
使用maxFileSize
和acceptFileTypes
的示例如下所示:
$('.cloudinary-fileupload').cloudinary_fileupload({maxFileSize:100000000,acceptFileTypes: /(.|\/)(gif|jpe?g|png|bmp|ico)$/i});