我使用jQuery-File-Upload作为上传器,当我启用图像缩放器时,有些用户会获得黑色图像。
因此,当他们选择图像(预览图像)时,它很好,但当他们点击确认开始上传图像时,结果是黑色图像,这是在使用Chrome浏览器的移动设备上发生的
这是我在页面上初始化插件的方式:
jQuery(function () {
'use strict';
// Initialize the jQuery File Upload widget:
jQuery('#formular').fileupload({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
url: '/upload_image.json',
dataType: 'json',
previewMaxWidth: 180,
previewMaxHeight: 135,
autoUpload: false,
maxFileSize: 73400320,
loadImageMaxFileSize: 73400320,
imageMaxWidth: 640,
imageMaxHeight: 480,
disableImageResize: /Android(?!.*Chrome)|Opera/
.test(window.navigator.userAgent),
process: [
{
action: 'load',
fileTypes: /^image\/(gif|jpeg|png|jpg)$/,
maxFileSize: 73400320
},
{
action: 'resize',
maxWidth: 640,
maxHeight: 480
},
{
action: 'save'
}
],
sequentialUploads: true,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
singleFileUploads: true,
submit: function(e ,data){
data.formData = [{
"name" : "action",
"value" : "upload_image",
},
{
"name" : "current_instance",
"value" : CURRENT_INSTANCE
},
{ "name" : "category_id",
"value" : jQuery('#category_group').val()
},
{
"name" : "image_rotate_value",
"value" : jQuery('#image_rotate_value').val()
}
];
}
});
// Enable iframe cross-domain access via redirect option:
jQuery('#formular').fileupload(
'option',
'redirect',
window.location.href.replace(
/\/[^\/]*$/,
'/cors/result.html?%s'
)
);
});
以前有人经历过吗?
我搜索了一下,但我一无所获。
由于