我在客户端创建和上传缩略图图像时发现了这个线程。踏板显示如何上传第一张图片,然后通过调整大小并再次上传来跟进。我想知道是否有一种简单的方法可以添加另一个步骤,以便最终结果会产生原始、中等大小和缩略图
A better solution is to trigger QueueChanged in the FileUploaded handler, and then call refresh. This will initiate the upload again for the same file and you can set a property that you read in the BeforeUpload handler to adjust the file size.
警告#1:您应该在全尺寸图像之后上传缩略图,否则全尺寸图像可能会出现一些缓冲区问题并被截断。
警告 #2:这仅在对 FileUploaded 的绑定调用发生在 uploader.init() 之后才有效,否则上传者自己的 FileUploaded 处理程序将在您的处理程序之后将 file.status 覆盖回 DONE。
下面是这个帖子的原始回复Plupload Thumbnail
uploader.bind('BeforeUpload', function(up, file) {
if('thumb' in file)
up.settings.resize = {width : 150, height : 150, quality : 100};
else
up.settings.resize = {width : 1600, height : 1600, quality : 100};
}
uploader.bind('FileUploaded', function(up, file) {
if(!('thumb' in file)) {
file.thumb = true;
file.loaded = 0;
file.percent = 0;
file.status = plupload.QUEUED;
up.trigger("QueueChanged");
up.refresh();
}
}