Problem resizing images client side with the Basic plugin

2,045 views
Skip to first unread message

Ludovico Mattiuzzo

unread,
Nov 3, 2012, 3:58:41 PM11/3/12
to jquery-f...@googlegroups.com

I can't make the image resize client side working with JQuery File Upload...

The file is correctly saved on the server, but the plugin does not do any File size check, Extension check, nor do resize the image prior to uploading.

What am I doing wrong?

I added those script on my page:

<script src="js/vendor/jquery.ui.widget.js"></script>
<script src="js/jquery.iframe-transport.js"></script>
<script src="js/jquery.fileupload.js"></script>
<script src="js/jquery.fileupload-fp.js"></script>

And this is the code that I'm using to bind Jquery file upload plugin:


<script>
    $(function () {
        $('#fileupload').fileupload({
            maxNumberOfFiles: 1,
            replaceFileInput: false,
            dataType: 'json',
            url: '<%= ResolveUrl("AjaxFileHandler.ashx") %>',
            done: function (e, data) {              
            },            
    process: [
        {
            action: 'load',
            fileTypes: /^image\/(gif|jpeg|png)$/,
            maxFileSize: 20000 // 20MB
        },
        {
            action: 'resize',
            maxWidth: 1920,
            maxHeight: 1200,
            minWidth: 800,
            minHeight: 600
        },
        {
            action: 'save'
        }
    ]
        });
    });
</script>

Ludovico Mattiuzzo

unread,
Nov 4, 2012, 7:14:45 AM11/4/12
to jquery-f...@googlegroups.com
Solved.. I think the problem is with the maxFileSize parameter, if the file is bigger than that no processing will occur

Tony Wisestub

unread,
Apr 11, 2013, 10:19:57 PM4/11/13
to jquery-f...@googlegroups.com
Hi, Thank you for sharing the solution. I had the same issue and your solution has helped me. Thanks again!

Неділя, 4 листопада 2012 р. 04:14:45 UTC-8 користувач Ludovico Mattiuzzo написав:
Reply all
Reply to author
Forward
0 new messages