plupload property items will be lost if you use Resize in Script Code.

Hi,

There is a small bug in PLUpload, a tool I highly recommend to use to upload files to MVC 3. It works really well.

The place to download the tool is from:

http://www.plupload.com/

Now, ensure this is disabled or commented out, else you will LOSE all image properties, such as camera settings and GPS. So ensure        // resize: { width: 320, height: 240, quality: 90 } is not used!

<script type="text/javascript">
    // Convert divs to queue widgets when the DOM is ready
    $(function () {
        $("#uploader").plupload({
            // General settings
            runtimes: ‘flash,html5,browserplus,silverlight,gears,html4’,
            url: ‘home/upload’,
            max_file_size: ‘1000mb’,
            max_file_count: 20, // user can add no more then 20 files at a time
            chunk_size: ‘1mb’,
            unique_names: true,
            multiple_queues: true,

            // Resize images on clientside if we can
           // resize: { width: 320, height: 240, quality: 90 },

            // Rename files by clicking on their titles
            rename: true,

            // Sort files
            sortable: true,

            // Specify what files to browse for
            filters: [
            { title: "Image files", extensions: "jpg,gif,png" },
            { title: "Zip files", extensions: "zip,avi" }
        ],

            // Flash settings
            flash_swf_url: ‘/Scripts/plupload/plupload.flash.swf’,

            // Silverlight settings
            silverlight_xap_url: ‘/Scripts/plupload/plupload.silverlight.xap’
        });

        // Client side form validation
        $(‘form’).submit(function (e) {
            var uploader = $(‘#uploader’).plupload(‘getUploader’);

            // Validate number of uploaded files
            if (uploader.total.uploaded == 0) {
                // Files in queue upload them first
                if (uploader.files.length > 0) {
                    // When all files are uploaded submit form
                    uploader.bind(‘UploadProgress’, function () {
                        if (uploader.total.uploaded == uploader.files.length)
                            $(‘form’).submit();
                    });

                    uploader.start();
                } else
                    alert(‘You must at least upload one file.’);

                e.preventDefault();
            }
        });

    });
</script>

 

If it is not commented out, the property list of the image will only have two items.

image

UPDATE 24/02/2011: It does keep properties with Image Resize if HTML 5 is being used, FLASH and SILVERLIGHT does not work currently with it, so if in doubt, use HTML 5 first.

Advertisements

2 thoughts on “plupload property items will be lost if you use Resize in Script Code.

  1. 🙂

    That’s not exactly true, we do retain some important properties for EXIF and less for GPS, although it works only for HTML5 runtime at the moment. But codebase is prepared for Flash, and for next release will move onto the SilverLight as well. Other runtimes unfortunately do not have direct access to file raw binary source.

    What properties you would like to see retained after the resize, let’s collaborate on this 🙂

    Please respond on the original ticket you’ve opened:
    https://github.com/moxiecode/plupload/issues/228

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s