I am implementing the Blueimp jQuery File Uploader https://github.com/blueimp/jQuery-File-Upload and I'm wanting to change the previewMaxWidth and previewMaxHeight after the first image is added. This is because I have a product feature image and then subsequent views of the product, each of which should display smaller than the feature image.
Here is my file upload call:
$('.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
});
There is present option
param that allows to change options after widget is initialized.
According to your code:
...
}).bind('fileuploadadded', function(e, data) {
$('.imageupload').fileupload(
'option',
{
previewMaxWidth: 60,
previewMaxHeight: 60
}
);
});
More info about changing options see at official API page (section Options).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With