4

我正在实现 Blueimp jQuery File Uploader https://github.com/blueimp/jQuery-File-Upload并且我想在添加第一张图像后更改previewMaxWidthpreviewMaxHeight。这是因为我有一个产品特征图像,然后是产品的后续视图,每个视图都应显示小于特征图像。

这是我的文件上传调用:

$('.imageupload').fileupload({
    autoUpload : true,
    acceptFileTypes : /(\.|\/)(gif|jpe?g|png)$/i,
    previewMaxWidth : 198,
    previewMaxHeight : 800,
    uploadTemplateId : 'product-add-image-upload',
    downloadTemplateId : 'product-add-image-download'
}).bind('fileuploadadded', function(e, data) {
    // change preview width/height to 60px/60px after first image loaded
    // not sure what to put here

});
4

1 回答 1

8

存在option允许在小部件初始化后更改选项的参数。

根据您的代码:

...

}).bind('fileuploadadded', function(e, data) {
    $('.imageupload').fileupload(
        'option',
        {
            previewMaxWidth: 60,
            previewMaxHeight: 60
        }
    );
});

有关更改选项的更多信息,请参见官方API页面(选项部分)。

于 2012-05-16T14:04:21.430 回答