Change previewMaxWidth / jQuery (blueimp) file upload height programmatically

I am implementing a jQuery file downloader for Blueimp https://github.com/blueimp/jQuery-File-Upload , and I want to change previewMaxWidth and previewMaxHeight after adding the first image. This is due to the fact that I have an image with a product function, and then subsequent representations of the product, each of which should be displayed less than the image of the function.

Here is my request to download the file:

$('.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

});
+3
source share
1 answer

Here there is a parameter optionthat allows you to change the parameters after the widget is initialized.

According to your code:

...

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

. API ( ).

+7

All Articles