jQuery File Upload Blueimp | Clientside resizing not working

104 Views Asked by At

I am trying to access the resized image in the add callback or any other callback, but the size does not change, its the original image.

let uploader = $('#cropper_upload_' + cropper_element_id).fileupload({
    autoUpload: false,
    //url: '/home/manage_classic_question_images',
    //dataType: 'json',
    forceIframeTransport: false, // dont know why, just copy pasted from old project
    maxNumberOfFiles: 1,
    singleFileUploads: true, // default anyway
    loadImageMaxFileSize: 10000000000, // 10GB
    maxFileSize: 1000000000, // 10GB
    imageQuality: 0.5,
    disableImageResize: false,
    imageMaxWidth: 350,
    imageMaxHeight: 350});
uploader.on('fileuploadadd', function (e, data) {
    let file = data.files[0];
    console_log(file);
});
uploader.on('fileuploadprogress', function (e, data) {
    let file = data.files[0];
    console_log(file);
});
uploader.on('fileuploadsubmit', function (e, data) {
    let file = data.files[0];
    console_log(file);
});
uploader.on('fileuploadalways', function (e, data) {
    let file = data.files[0];
    console_log(file);
});
uploader.on('fileuploadprocessstart', function () {
    console.log('processstart');
});

According to the docs it should just work by enabling this:

all you need to do is to set the option disableImageResize to false

I am using the library in laravel 9 and installed the dependencies with npm install blueimp-file-upload. I checked the node_modules folder and the library also includes the jquery.fileupload-ui.js. From my old project I remember that this was necessary to make client side resizing work.

I am sitting on this for way too long already, maybe someone else still uses the library and can help?

0

There are 0 best solutions below