jQuery文件上传:原始图像的大小

时间:2017-11-11 13:20:41

标签: jquery performance resize size image-resizing

我使用jQuery文件上传保存:

Original file;
Big;
Medium;
Thumb;

现在我发送50张图片,原件是文件夹大小的85%。

原件将图像保存为1280像素,如何将其更改为800x800?

1 个答案:

答案 0 :(得分:0)

解决方案是改变: imageMaxWidth和imageMaxHeight参数。完整的例子:

$('#fileupload').fileupload({
        url: url,
        dataType: 'json',
        paramName: 'files[]',
        autoUpload: true,
        acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
        maxFileSize: 999000,
        // Enable image resizing, except for Android and Opera,
        // which actually support image resizing, but fail to
        // send Blob objects via XHR requests:
        disableImageResize: /Android(?!.*Chrome)|Opera/
            .test(window.navigator.userAgent),
        //previewMaxWidth: 100,
        //previewMaxHeight: 100,
        imageMaxWidth: 800,
        imageMaxHeight: 800,
        imageCrop: false,
        previewCrop: true
    });