php - 使用 Blueimp 上传 +cropper.js 上传一些文件的问题
问题描述
我有一个系统,用户可以将一些照片发送到服务器,客户端接收它来制作它们的宝丽来版本。
用户可以选择是否裁剪它们。
我使用 Blueimp ( https://github.com/blueimp/jQuery-File-Upload ) 上传图像和cropper.js ( https://fengyuanchen.github.io/cropperjs/ ) 来裁剪它们。
但是有些用户抱怨有些文件没有上传,但没有显示错误。
不是扩展名,不是大小...我不知道可能是什么问题...
在这个文件(jquery.fileupload-ui.js)中,我找到了一行代码,如果我删除它,它可以工作,但我看不到文件的缩略图。但文件已上传。是 always 函数之前的最后一行。
add: function (e, data) {
if (e.isDefaultPrevented()) {
return false;
}
var $this = $(this),
that = $this.data('blueimp-fileupload') ||
$this.data('fileupload'),
options = that.options;
data.context = that._renderUpload(data.files)
.data('data', data)
.addClass('processing');
options.filesContainer[
options.prependFiles ? 'prepend' : 'append'
](data.context);
that._forceReflow(data.context);
that._transition(data.context);
data.process(function () {
// return $this.fileupload('process', data);
}).always(function () {
data.context.each(function (index) {
$(this).find('.size').text(
that._formatFileSize(data.files[index].size)
);
}).removeClass('processing');
that._renderPreviews(data);
}).done(function () {
data.context.find('.start').prop('disabled', false);
if ((that._trigger('added', e, data) !== false) &&
(options.autoUpload || data.autoUpload) &&
data.autoUpload !== false) {
data.submit();
}
}).fail(function () {
if (data.files.error) {
data.context.each(function (index) {
var error = data.files[index].error;
if (error) {
$(this).find('.error').text(error);
}
});
}
});
解决方案
推荐阅读
- android - Firebase 跟踪取消
- javascript - React FontAwesome Icon 没有为 onClick 传递道具
- spring-kafka - Spring Kafka 线程命名约定
- r - 多个条件组合的 ifelse 语句
- sql - 如何根据列值组合多行
- ssis - 在 SSIS 中使用 Renci 时如何避免崩溃
- javascript - 如何让我的 Discord 机器人每隔一个星期四在特定时间发一条消息?
- javascript - 圆形包装中的文本路径无法正确缩放
- opengl-es - OpenGL ES 深度帧缓冲 GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
- r - 如何使用ggplot定义分组因子中的刻度数