Is there a way to upload multiple resolutions at the same time?
I love the way you can use client-side resolution scaling, which saves complexity on the back end.
Is there a way to have the upload do the upload with multiple scaled images, of different resolutions?
I'd like to upload 2-3 different resolutions of the image, all doing the scaling on the front end.
Thanks again.
RyanE
Yes, it's possible. Here's an example code snippet:
$('#fileupload').fileupload({
submit: function (e, data) {
var resizeSettings = [
{resizeMaxWidth: 1280},
{resizeMaxWidth: 1024},
{resizeMaxWidth: 800}
],
$this = $(this),
originalFile = data.files[0],
filestoSubmit = [],
deferred = $.Deferred(),
promise = deferred.promise();
$.each(resizeSettings, function (index, settings) {
promise = promise.pipe(function () {
filestoSubmit.push(data.files[0]);
data.files = [originalFile];
$.extend(data, settings);
return $this.fileupload('resize', data);
});
});
deferred.resolve();
promise.done(function () {
filestoSubmit.push(data.files[0]);
data.files = filestoSubmit;
$this.fileupload('send', data);
});
return false;
}
});
Please note that I've updated the Image Processing plugin to allow the code snippet above to work properly.
Awesome! Thanks for answering this and my other question so quickly. I'll give it a try tonight and close the issues if I can get 'em working.
Thanks again!
I've added a slightly modified version to the Wiki: https://github.com/blueimp/jQuery-File-Upload/wiki/Upload-multiple-resolutions-of-one-image-with-multiple-resize-options
hey can you please take a looak at this https://github.com/blueimp/jQuery-File-Upload/issues/1076
I've added the code to my main.js, and it appears the submit function gets called for each resolution (and the resize method gets called multiple times before the upload), but only a single file gets sent to my upload URL, the original size (after the 'load' resize).
I can't figure out why it's not working, except it appears that in the _resizeImage function, the canvas height and width are always 640x480, so it never calls canvastoblob.
Any ideas? Or could you modify the sample main.js so it does the multiple file uploads?
Thanks for the help.
Nevermind... It appears it is uploading all the images. duh. :)
My .cgi just isn't looking for them properly.
Thanks agian.