From a44bd91731d6594e6e2aff359e7cde769b62e0a8 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Tue, 23 Oct 2012 15:00:08 +0900 Subject: [PATCH 001/759] Return success status of DELETE request. Fixes #1796. --- server/php/upload.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/php/upload.class.php b/server/php/upload.class.php index dcfa658a3..dbea04c98 100644 --- a/server/php/upload.class.php +++ b/server/php/upload.class.php @@ -1,6 +1,6 @@ generate_response($info, $print_response); + return $this->generate_response($success, $print_response); } } From 825879e070d60e02067caf5315a0e08ff6acb96b Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Tue, 23 Oct 2012 16:39:56 +0900 Subject: [PATCH 002/759] Improved NoScript usability. --- css/jquery.fileupload-ui-noscript.css | 27 +++++++++++++++++++++++++++ index.html | 10 +++++++--- js/main.js | 19 ++++++++++++------- 3 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 css/jquery.fileupload-ui-noscript.css diff --git a/css/jquery.fileupload-ui-noscript.css b/css/jquery.fileupload-ui-noscript.css new file mode 100644 index 000000000..c45048559 --- /dev/null +++ b/css/jquery.fileupload-ui-noscript.css @@ -0,0 +1,27 @@ +@charset "UTF-8"; +/* + * jQuery File Upload UI Plugin NoScript CSS 1.0 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2012, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +.fileinput-button input { + position: static; + opacity: 1; + filter: none; + transform: none; + font-size: inherit; + direction: inherit; +} + +.fileinput-button span, +.fileinput-button i, +.fileupload-buttonbar .delete, +.fileupload-buttonbar .toggle { + display: none; +} diff --git a/index.html b/index.html index c04c54f9c..cb8be2dd1 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@ + + @@ -46,7 +48,7 @@ jQuery File Upload -
+

Demo Notes

@@ -112,6 +112,10 @@

Demo Notes

+ + + + + + + + diff --git a/js/jquery.fileupload-angular.js b/js/jquery.fileupload-angular.js index b2f36bb8b..dec97a3dd 100644 --- a/js/jquery.fileupload-angular.js +++ b/js/jquery.fileupload-angular.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload AngularJS Plugin 1.1.2 + * jQuery File Upload AngularJS Plugin 1.2 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan @@ -20,6 +20,8 @@ 'jquery', 'angular', './jquery.fileupload-image', + './jquery.fileupload-audio', + './jquery.fileupload-video', './jquery.fileupload-validate' ], factory); } else { diff --git a/js/jquery.fileupload-audio.js b/js/jquery.fileupload-audio.js new file mode 100644 index 000000000..83b11c548 --- /dev/null +++ b/js/jquery.fileupload-audio.js @@ -0,0 +1,111 @@ +/* + * jQuery File Upload Audio Preview Plugin 1.0 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, unparam: true, regexp: true */ +/*global define, window, document */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'load-image', + './jquery.fileupload-process' + ], factory); + } else { + // Browser globals: + factory( + window.jQuery, + window.loadImage + ); + } +}(function ($, loadImage) { + 'use strict'; + + // Prepend to the default processQueue: + $.blueimp.fileupload.prototype.options.processQueue.unshift( + { + action: 'loadAudio', + // Always trigger this action, + // even if the previous action was rejected: + always: true, + fileTypes: '@loadAudioFileTypes', + maxFileSize: '@loadAudioMaxFileSize', + disabled: '@disableAudioLoad' + }, + { + action: 'setAudio', + name: '@audioPreviewName', + disabled: '@disableAudioPreview' + } + ); + + // The File Upload Audio Preview plugin extends the fileupload widget + // with audio preview functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // The regular expression for the types of audio files to load, + // matched against the file type: + loadAudioFileTypes: /^audio\/.*$/ + }, + + _audioElement: document.createElement('audio'), + + processActions: { + + // Loads the audio file given via data.files and data.index + // as audio element if the browser supports playing it. + // Accepts the options fileTypes (regular expression) + // and maxFileSize (integer) to limit the files to load: + loadAudio: function (data, options) { + if (options.disabled) { + return data; + } + var that = this, + file = data.files[data.index], + dfd = $.Deferred(), + url, + audio; + if (this._audioElement.canPlayType && + this._audioElement.canPlayType(file.type) && + ($.type(options.maxFileSize) !== 'number' || + file.size <= options.maxFileSize) && + (!options.fileTypes || + options.fileTypes.test(file.type))) { + url = loadImage.createObjectURL(file); + if (url) { + audio = this._audioElement.cloneNode(); + audio.src = url; + audio.controls = true; + data.audio = audio; + dfd.resolveWith(that, [data]); + return dfd.promise(); + } + } + dfd.rejectWith(that, [data]); + return dfd.promise(); + }, + + // Sets the audio element as a property of the file object: + setAudio: function (data, options) { + if (data.audio && !options.disabled) { + data.files[data.index][options.name || 'preview'] = data.audio; + } + return data; + } + + } + + }); + +})); diff --git a/js/jquery.fileupload-ui.js b/js/jquery.fileupload-ui.js index 71fa3c422..fb3f13a53 100644 --- a/js/jquery.fileupload-ui.js +++ b/js/jquery.fileupload-ui.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload User Interface Plugin 8.2.3 + * jQuery File Upload User Interface Plugin 8.3 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2010, Sebastian Tschan @@ -20,6 +20,8 @@ 'jquery', 'tmpl', './jquery.fileupload-image', + './jquery.fileupload-audio', + './jquery.fileupload-video', './jquery.fileupload-validate' ], factory); } else { diff --git a/js/jquery.fileupload-video.js b/js/jquery.fileupload-video.js new file mode 100644 index 000000000..5f11cd1ea --- /dev/null +++ b/js/jquery.fileupload-video.js @@ -0,0 +1,111 @@ +/* + * jQuery File Upload Video Preview Plugin 1.0 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, unparam: true, regexp: true */ +/*global define, window, document */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'load-image', + './jquery.fileupload-process' + ], factory); + } else { + // Browser globals: + factory( + window.jQuery, + window.loadImage + ); + } +}(function ($, loadImage) { + 'use strict'; + + // Prepend to the default processQueue: + $.blueimp.fileupload.prototype.options.processQueue.unshift( + { + action: 'loadVideo', + // Always trigger this action, + // even if the previous action was rejected: + always: true, + fileTypes: '@loadVideoFileTypes', + maxFileSize: '@loadVideoMaxFileSize', + disabled: '@disableVideoLoad' + }, + { + action: 'setVideo', + name: '@videoPreviewName', + disabled: '@disableVideoPreview' + } + ); + + // The File Upload Video Preview plugin extends the fileupload widget + // with video preview functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // The regular expression for the types of video files to load, + // matched against the file type: + loadVideoFileTypes: /^video\/.*$/ + }, + + _videoElement: document.createElement('video'), + + processActions: { + + // Loads the video file given via data.files and data.index + // as video element if the browser supports playing it. + // Accepts the options fileTypes (regular expression) + // and maxFileSize (integer) to limit the files to load: + loadVideo: function (data, options) { + if (options.disabled) { + return data; + } + var that = this, + file = data.files[data.index], + dfd = $.Deferred(), + url, + video; + if (this._videoElement.canPlayType && + this._videoElement.canPlayType(file.type) && + ($.type(options.maxFileSize) !== 'number' || + file.size <= options.maxFileSize) && + (!options.fileTypes || + options.fileTypes.test(file.type))) { + url = loadImage.createObjectURL(file); + if (url) { + video = this._videoElement.cloneNode(); + video.src = url; + video.controls = true; + data.video = video; + dfd.resolveWith(that, [data]); + return dfd.promise(); + } + } + dfd.rejectWith(that, [data]); + return dfd.promise(); + }, + + // Sets the video element as a property of the file object: + setVideo: function (data, options) { + if (data.video && !options.disabled) { + data.files[data.index][options.name || 'preview'] = data.video; + } + return data; + } + + } + + }); + +})); diff --git a/test/index.html b/test/index.html index a4dd221bb..38d52021d 100644 --- a/test/index.html +++ b/test/index.html @@ -1,7 +1,7 @@ diff --git a/basic-plus.html b/basic-plus.html index f6a6b4ae9..5cb586de0 100644 --- a/basic-plus.html +++ b/basic-plus.html @@ -1,7 +1,7 @@ diff --git a/basic.html b/basic.html index 8a53d41fb..c29b7ddce 100644 --- a/basic.html +++ b/basic.html @@ -1,7 +1,7 @@ diff --git a/cors/postmessage.html b/cors/postmessage.html index 6f3bede9d..3d1448f08 100644 --- a/cors/postmessage.html +++ b/cors/postmessage.html @@ -1,7 +1,7 @@ - + diff --git a/test/index.html b/test/index.html index 38d52021d..a43f3ea0b 100644 --- a/test/index.html +++ b/test/index.html @@ -1,7 +1,7 @@ - + From 921c81694e4d13744f8135541c11d959ca88881b Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Tue, 11 Jun 2013 04:52:49 -0500 Subject: [PATCH 178/759] Retain EXIF and ICC headers with client-side image processing. Closes #1207. Use Exif data thumbnails if available, which increases UI performance largely when displaying thumbnails of large image files. --- js/jquery.fileupload-image.js | 91 +++++++++++++++++++++++++++++++---- 1 file changed, 82 insertions(+), 9 deletions(-) diff --git a/js/jquery.fileupload-image.js b/js/jquery.fileupload-image.js index 561fc8b81..9df047c9f 100644 --- a/js/jquery.fileupload-image.js +++ b/js/jquery.fileupload-image.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload Image Preview & Resize Plugin 1.0 + * jQuery File Upload Image Preview & Resize Plugin 1.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan @@ -10,7 +10,7 @@ */ /*jslint nomen: true, unparam: true, regexp: true */ -/*global define, window */ +/*global define, window, document, DataView, Blob, Uint8Array */ (function (factory) { 'use strict'; @@ -44,6 +44,15 @@ noRevoke: '@loadImageNoRevoke', disabled: '@disableImageLoad' }, + { + action: 'loadImageMetaData', + disabled: '@disableImageMetaDataLoad', + disableImageHead: '@disableImageHead', + disableExif: '@disableExif', + disableExifThumbnail: '@disableExifThumbnail', + disableExifSub: '@disableExifSub', + disableExifGps: '@disableExifGps' + }, { action: 'resizeImage', maxWidth: '@imageMaxWidth', @@ -57,6 +66,10 @@ action: 'saveImage', disabled: '@disableImageResize' }, + { + action: 'saveImageMetaData', + disabled: '@disableImageMetaDataSave' + }, { action: 'resizeImage', maxWidth: '@previewMaxWidth', @@ -64,6 +77,8 @@ minWidth: '@previewMinWidth', minHeight: '@previewMinHeight', crop: '@previewCrop', + orientation: '@previewOrientation', + thumbnail: '@previewThumbnail', canvas: '@previewAsCanvas', disabled: '@disableImagePreview' }, @@ -96,6 +111,11 @@ previewMaxWidth: 80, // The maximum height of the preview images: previewMaxHeight: 80, + // Defines the preview orientation (1-8) or takes the orientation + // value from Exif data if set to true: + previewOrientation: true, + // Create the preview using the Exif data thumbnail: + previewThumbnail: true, // Define if preview images should be cropped or only scaled: previewCrop: false, // Define if preview images should be resized as canvas elements: @@ -140,14 +160,38 @@ // Accepts the options maxWidth, maxHeight, minWidth, // minHeight, canvas and crop: resizeImage: function (data, options) { + if (options.disabled) { + return data; + } + var that = this, + dfd = $.Deferred(), + resolve = function (newImg) { + data[newImg.getContext ? 'canvas' : 'img'] = newImg; + dfd.resolveWith(that, [data]); + }, + thumbnail, + img, + newImg; options = $.extend({canvas: true}, options); - var img = (options.canvas && data.canvas) || data.img, - canvas; - if (img && !options.disabled) { - canvas = loadImage.scale(img, options); - if (canvas && (canvas.width !== img.width || - canvas.height !== img.height)) { - data[canvas.getContext ? 'canvas' : 'img'] = canvas; + if (data.exif) { + if (options.orientation === true) { + options.orientation = data.exif.get('Orientation'); + } + if (options.thumbnail) { + thumbnail = data.exif.get('Thumbnail'); + if (thumbnail) { + loadImage(thumbnail, resolve, options); + return dfd.promise(); + } + } + } + img = (options.canvas && data.canvas) || data.img; + if (img) { + newImg = loadImage.scale(img, options); + if (newImg.width !== img.width || + newImg.height !== img.height) { + resolve(newImg); + return dfd.promise(); } } return data; @@ -196,6 +240,35 @@ return dfd.promise(); }, + loadImageMetaData: function (data, options) { + if (options.disabled) { + return data; + } + var that = this, + dfd = $.Deferred(); + loadImage.parseMetaData(data.files[data.index], function (result) { + $.extend(data, result); + dfd.resolveWith(that, [data]); + }, options); + return dfd.promise(); + }, + + saveImageMetaData: function (data, options) { + if (!data.imageHead || options.disabled) { + return data; + } + var file = data.files[data.index], + blob = new Blob([ + data.imageHead, + // Resized images always have a head size of 20, + // including the JPEG marker and a minimal JFIF header: + this._blobSlice.call(file, 20) + ], {type: file.type}); + blob.name = file.name; + data.files[data.index] = blob; + return data; + }, + // Sets the resized version of the image as a property of the // file object, must be called after "saveImage": setImage: function (data, options) { From c29e5cc2194b73114cfa7c7fc4fbaefdd7194c66 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Tue, 11 Jun 2013 05:50:41 -0500 Subject: [PATCH 179/759] Refactored @-options handling to save bytes. If an option is set to @, the global option of the same name as the key will be used, e.g.: acceptFileTypes: '@', // acceptFileTypes If the options set contains a property prefix, the global options key will be the prefix plus the option key, concatenated in camel-case spelling, e.g.: prefix: 'loadImage', acceptFileTypes: '@', // loadImageAcceptFileTypes If the prefix is set to true, the action of the options set will be used as key. --- js/jquery.fileupload-image.js | 65 ++++++++++++++++++-------------- js/jquery.fileupload-process.js | 11 ++++-- js/jquery.fileupload-validate.js | 10 ++--- 3 files changed, 50 insertions(+), 36 deletions(-) diff --git a/js/jquery.fileupload-image.js b/js/jquery.fileupload-image.js index 9df047c9f..723de13ac 100644 --- a/js/jquery.fileupload-image.js +++ b/js/jquery.fileupload-image.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload Image Preview & Resize Plugin 1.1 + * jQuery File Upload Image Preview & Resize Plugin 1.2 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan @@ -35,31 +35,35 @@ // Prepend to the default processQueue: $.blueimp.fileupload.prototype.options.processQueue.unshift( { - action: 'loadImage', + action: 'loadImageMetaData', // Always trigger this action, // even if the previous action was rejected: always: true, - fileTypes: '@loadImageFileTypes', - maxFileSize: '@loadImageMaxFileSize', - noRevoke: '@loadImageNoRevoke', - disabled: '@disableImageLoad' + disableImageHead: '@', + disableExif: '@', + disableExifThumbnail: '@', + disableExifSub: '@', + disableExifGps: '@', + disabled: '@disableImageMetaDataLoad' }, { - action: 'loadImageMetaData', - disabled: '@disableImageMetaDataLoad', - disableImageHead: '@disableImageHead', - disableExif: '@disableExif', - disableExifThumbnail: '@disableExifThumbnail', - disableExifSub: '@disableExifSub', - disableExifGps: '@disableExifGps' + action: 'loadImage', + // Use the action as prefix for the "@" options: + prefix: true, + fileTypes: '@', + maxFileSize: '@', + noRevoke: '@', + disabled: '@disableImageLoad' }, { action: 'resizeImage', - maxWidth: '@imageMaxWidth', - maxHeight: '@imageMaxHeight', - minWidth: '@imageMinWidth', - minHeight: '@imageMinHeight', - crop: '@imageCrop', + // Use "image" as prefix for the "@" options: + prefix: 'image', + maxWidth: '@', + maxHeight: '@', + minWidth: '@', + minHeight: '@', + crop: '@', disabled: '@disableImageResize' }, { @@ -72,14 +76,19 @@ }, { action: 'resizeImage', - maxWidth: '@previewMaxWidth', - maxHeight: '@previewMaxHeight', - minWidth: '@previewMinWidth', - minHeight: '@previewMinHeight', - crop: '@previewCrop', - orientation: '@previewOrientation', - thumbnail: '@previewThumbnail', - canvas: '@previewAsCanvas', + // Always trigger this action, + // even if the previous action was rejected: + always: true, + // Use "preview" as prefix for the "@" options: + prefix: 'preview', + maxWidth: '@', + maxHeight: '@', + minWidth: '@', + minHeight: '@', + crop: '@', + orientation: '@', + thumbnail: '@', + canvas: '@', disabled: '@disableImagePreview' }, { @@ -98,7 +107,7 @@ // matched against the file type: loadImageFileTypes: /^image\/(gif|jpeg|png)$/, // The maximum file size of images to load: - loadImageMaxFileSize: 5000000, // 5MB + loadImageMaxFileSize: 10000000, // 10MB // The maximum width of resized images: imageMaxWidth: 1920, // The maximum height of resized images: @@ -119,7 +128,7 @@ // Define if preview images should be cropped or only scaled: previewCrop: false, // Define if preview images should be resized as canvas elements: - previewAsCanvas: true + previewCanvas: true }, processActions: { diff --git a/js/jquery.fileupload-process.js b/js/jquery.fileupload-process.js index 2f9eeed2c..c10c67832 100644 --- a/js/jquery.fileupload-process.js +++ b/js/jquery.fileupload-process.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload Processing Plugin 1.1 + * jQuery File Upload Processing Plugin 1.2 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2012, Sebastian Tschan @@ -98,11 +98,16 @@ _transformProcessQueue: function (options) { var processQueue = []; $.each(options.processQueue, function () { - var settings = {}; + var settings = {}, + action = this.action, + prefix = this.prefix === true ? action : this.prefix; $.each(this, function (key, value) { if ($.type(value) === 'string' && value.charAt(0) === '@') { - settings[key] = options[value.slice(1)]; + settings[key] = options[ + value.slice(1) || prefix ? prefix + + key.charAt(0).toUpperCase() + key.slice(1) : key + ]; } else { settings[key] = value; } diff --git a/js/jquery.fileupload-validate.js b/js/jquery.fileupload-validate.js index 2599da82a..1cc4f1ebb 100644 --- a/js/jquery.fileupload-validate.js +++ b/js/jquery.fileupload-validate.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload Validation Plugin 1.0.2 + * jQuery File Upload Validation Plugin 1.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan @@ -37,10 +37,10 @@ // even if the previous action was rejected: always: true, // Options taken from the global options map: - acceptFileTypes: '@acceptFileTypes', - maxFileSize: '@maxFileSize', - minFileSize: '@minFileSize', - maxNumberOfFiles: '@maxNumberOfFiles', + acceptFileTypes: '@', + maxFileSize: '@', + minFileSize: '@', + maxNumberOfFiles: '@', disabled: '@disableValidation' } ); From f74f3395eb5a9cadae01c343985a2b34b81ea831 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Tue, 11 Jun 2013 17:40:23 -0500 Subject: [PATCH 180/759] Use the action as prefix for the "@" options. --- js/jquery.fileupload-audio.js | 8 +++++--- js/jquery.fileupload-video.js | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/js/jquery.fileupload-audio.js b/js/jquery.fileupload-audio.js index 83b11c548..41f0fdb93 100644 --- a/js/jquery.fileupload-audio.js +++ b/js/jquery.fileupload-audio.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload Audio Preview Plugin 1.0 + * jQuery File Upload Audio Preview Plugin 1.0.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan @@ -38,8 +38,10 @@ // Always trigger this action, // even if the previous action was rejected: always: true, - fileTypes: '@loadAudioFileTypes', - maxFileSize: '@loadAudioMaxFileSize', + // Use the action as prefix for the "@" options: + prefix: true, + fileTypes: '@', + maxFileSize: '@', disabled: '@disableAudioLoad' }, { diff --git a/js/jquery.fileupload-video.js b/js/jquery.fileupload-video.js index 5f11cd1ea..44c659e1c 100644 --- a/js/jquery.fileupload-video.js +++ b/js/jquery.fileupload-video.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload Video Preview Plugin 1.0 + * jQuery File Upload Video Preview Plugin 1.0.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan @@ -38,8 +38,10 @@ // Always trigger this action, // even if the previous action was rejected: always: true, - fileTypes: '@loadVideoFileTypes', - maxFileSize: '@loadVideoMaxFileSize', + // Use the action as prefix for the "@" options: + prefix: true, + fileTypes: '@', + maxFileSize: '@', disabled: '@disableVideoLoad' }, { From d9e411af36b361a27dce952ca75bf0e8a0d4fb5f Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Tue, 11 Jun 2013 17:48:55 -0500 Subject: [PATCH 181/759] Use the disable option for both loading and setting the preview element. --- js/jquery.fileupload-audio.js | 2 +- js/jquery.fileupload-video.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/jquery.fileupload-audio.js b/js/jquery.fileupload-audio.js index 41f0fdb93..92fd57b84 100644 --- a/js/jquery.fileupload-audio.js +++ b/js/jquery.fileupload-audio.js @@ -42,7 +42,7 @@ prefix: true, fileTypes: '@', maxFileSize: '@', - disabled: '@disableAudioLoad' + disabled: '@disableAudioPreview' }, { action: 'setAudio', diff --git a/js/jquery.fileupload-video.js b/js/jquery.fileupload-video.js index 44c659e1c..88c24d03d 100644 --- a/js/jquery.fileupload-video.js +++ b/js/jquery.fileupload-video.js @@ -42,7 +42,7 @@ prefix: true, fileTypes: '@', maxFileSize: '@', - disabled: '@disableVideoLoad' + disabled: '@disableVideoPreview' }, { action: 'setVideo', From 2d7e86acc1d7078d5bde6e54e3786f5e88e9a3e9 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Tue, 11 Jun 2013 18:58:56 -0500 Subject: [PATCH 182/759] Allow defining upload_dir/upload_url for each image version. Closes #2340. --- server/php/UploadHandler.php | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/server/php/UploadHandler.php b/server/php/UploadHandler.php index 7b42e9f26..60b08fac3 100644 --- a/server/php/UploadHandler.php +++ b/server/php/UploadHandler.php @@ -1,6 +1,6 @@ array( + // Uncomment the following to use a defined directory for the thumbnails + // instead of a subdirectory based on the version identifier. + // Make sure that this directory doesn't allow execution of files if you + // don't pose any restrictions on the type of uploaded files, e.g. by + // copying the .htaccess file from the files directory for Apache: + //'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/thumb/', + //'upload_url' => $this->get_full_url().'/thumb/', // Uncomment the following to force the max // dimensions and e.g. create square thumbnails: //'crop' => true, @@ -175,7 +182,15 @@ protected function get_user_path() { protected function get_upload_path($file_name = null, $version = null) { $file_name = $file_name ? $file_name : ''; - $version_path = empty($version) ? '' : $version.'/'; + if (empty($version)) { + $version_path = ''; + } else { + $version_dir = @$this->options['image_versions'][$version]['upload_dir']; + if ($version_dir) { + return $version_dir.$this->get_user_path().$file_name; + } + $version_path = $version.'/'; + } return $this->options['upload_dir'].$this->get_user_path() .$version_path.$file_name; } @@ -194,7 +209,15 @@ protected function get_download_url($file_name, $version = null, $direct = false } return $url.'&download=1'; } - $version_path = empty($version) ? '' : rawurlencode($version).'/'; + if (empty($version)) { + $version_path = ''; + } else { + $version_url = @$this->options['image_versions'][$version]['upload_url']; + if ($version_url) { + return $version_url.$this->get_user_path().rawurlencode($file_name); + } + $version_path = rawurlencode($version).'/'; + } return $this->options['upload_url'].$this->get_user_path() .$version_path.rawurlencode($file_name); } From 377652a472340b12b5404bf78e6aea3630081e57 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Tue, 11 Jun 2013 20:31:01 -0500 Subject: [PATCH 183/759] Updated package version. --- blueimp-file-upload.jquery.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blueimp-file-upload.jquery.json b/blueimp-file-upload.jquery.json index c81b4cbe6..4c020124c 100644 --- a/blueimp-file-upload.jquery.json +++ b/blueimp-file-upload.jquery.json @@ -1,6 +1,6 @@ { "name": "blueimp-file-upload", - "version": "8.2.1", + "version": "8.3.0", "title": "jQuery File Upload", "author": { "name": "Sebastian Tschan", diff --git a/package.json b/package.json index 59dba5072..b6d7c5bae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blueimp-file-upload", - "version": "8.2.1", + "version": "8.3.0", "title": "jQuery File Upload", "description": "File Upload widget with multiple file selection, drag&drop support, progress bars and preview images for jQuery. Supports cross-domain, chunked and resumable file uploads and client-side image resizing. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.", "keywords": [ From cebdbfd1aafedff1766f17d58bb16e7040cf1ab5 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 12 Jun 2013 02:14:24 -0500 Subject: [PATCH 184/759] Remove upload methods from the scope when the widget is removed. Fixes #2258. --- js/jquery.fileupload-angular.js | 57 ++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/js/jquery.fileupload-angular.js b/js/jquery.fileupload-angular.js index dec97a3dd..0f15ce61b 100644 --- a/js/jquery.fileupload-angular.js +++ b/js/jquery.fileupload-angular.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload AngularJS Plugin 1.2 + * jQuery File Upload AngularJS Plugin 1.2.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan @@ -170,6 +170,29 @@ .controller('FileUploadController', [ '$scope', '$element', '$attrs', 'fileUpload', function ($scope, $element, $attrs, fileUpload) { + var uploadMethods = { + progress: function () { + return $element.fileupload('progress'); + }, + active: function () { + return $element.fileupload('active'); + }, + option: function (option, data) { + return $element.fileupload('option', option, data); + }, + add: function (data) { + return $element.fileupload('add', data); + }, + send: function (data) { + return $element.fileupload('send', data); + }, + process: function (data) { + return $element.fileupload('process', data); + }, + processing: function (data) { + return $element.fileupload('processing', data); + } + }; $scope.disabled = angular.element('') .prop('disabled'); $scope.queue = $scope.queue || []; @@ -202,27 +225,6 @@ } } }; - $scope.progress = function () { - return $element.fileupload('progress'); - }; - $scope.active = function () { - return $element.fileupload('active'); - }; - $scope.option = function (option, data) { - return $element.fileupload('option', option, data); - }; - $scope.add = function (data) { - return $element.fileupload('add', data); - }; - $scope.send = function (data) { - return $element.fileupload('send', data); - }; - $scope.process = function (data) { - return $element.fileupload('process', data); - }; - $scope.processing = function (data) { - return $element.fileupload('processing', data); - }; $scope.applyOnQueue = function (method) { var list = this.queue.slice(0), i, @@ -240,6 +242,8 @@ $scope.cancel = function () { this.applyOnQueue('$cancel'); }; + // Add upload methods to the scope: + angular.extend($scope, uploadMethods); // The fileupload widget will initialize with // the options provided via "data-"-parameters, // as well as those given via options object: @@ -277,6 +281,15 @@ 'fileuploadprocessstop' ].join(' '), function (e, data) { $scope.$emit(e.type, data); + }).on('remove', function () { + // Remove upload methods from the scope, + // when the widget is removed: + var method; + for (method in uploadMethods) { + if (uploadMethods.hasOwnProperty(method)) { + delete $scope[method]; + } + } }); // Observe option changes: $scope.$watch( From 7709dbbb91bc0b2f7707ec7f31c3e55543594139 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 12 Jun 2013 02:35:25 -0500 Subject: [PATCH 185/759] Updated required version of the Load Image library. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b6d7c5bae..83f93d60b 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "jquery": ">=1.6", "jquery.ui.widget": ">=1.9", "blueimp-tmpl": ">=2.1.0", - "blueimp-load-image": ">=1.5.0", + "blueimp-load-image": ">=1.7.0", "blueimp-canvas-to-blob": ">=2.0.5" } } From 25075410b2fae2f018c7e992d0f6434442fd681b Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 12 Jun 2013 02:42:57 -0500 Subject: [PATCH 186/759] Updated the AMD module requirements. --- js/jquery.fileupload-image.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/jquery.fileupload-image.js b/js/jquery.fileupload-image.js index 723de13ac..b0acb93d4 100644 --- a/js/jquery.fileupload-image.js +++ b/js/jquery.fileupload-image.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload Image Preview & Resize Plugin 1.2 + * jQuery File Upload Image Preview & Resize Plugin 1.2.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan @@ -19,6 +19,9 @@ define([ 'jquery', 'load-image', + 'load-image-meta', + 'load-image-exif', + 'load-image-ios', 'canvas-to-blob', './jquery.fileupload-process' ], factory); From afc995f62cb40826f1938cff0ebebf1ef727d68e Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 12 Jun 2013 04:21:40 -0500 Subject: [PATCH 187/759] Updated package description. --- blueimp-file-upload.jquery.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blueimp-file-upload.jquery.json b/blueimp-file-upload.jquery.json index 4c020124c..a699dbce2 100644 --- a/blueimp-file-upload.jquery.json +++ b/blueimp-file-upload.jquery.json @@ -16,7 +16,7 @@ "jquery": ">=1.6", "jquery.ui.widget": ">=1.9" }, - "description": "File Upload widget with multiple file selection, drag&drop support, progress bars and preview images for jQuery. Supports cross-domain, chunked and resumable file uploads and client-side image resizing. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.", + "description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.", "keywords": [ "jquery", "file", diff --git a/package.json b/package.json index 83f93d60b..c58f5d4c9 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "blueimp-file-upload", "version": "8.3.0", "title": "jQuery File Upload", - "description": "File Upload widget with multiple file selection, drag&drop support, progress bars and preview images for jQuery. Supports cross-domain, chunked and resumable file uploads and client-side image resizing. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.", + "description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.", "keywords": [ "jquery", "file", From e9d1728fddf62dfdce8cefac897511480acdfb60 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 12 Jun 2013 04:47:54 -0500 Subject: [PATCH 188/759] Fixed "@" options handling. --- js/jquery.fileupload-process.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/jquery.fileupload-process.js b/js/jquery.fileupload-process.js index c10c67832..08ce86c56 100644 --- a/js/jquery.fileupload-process.js +++ b/js/jquery.fileupload-process.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload Processing Plugin 1.2 + * jQuery File Upload Processing Plugin 1.2.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2012, Sebastian Tschan @@ -98,19 +98,21 @@ _transformProcessQueue: function (options) { var processQueue = []; $.each(options.processQueue, function () { - var settings = {}, + var that = this, + settings = {}, action = this.action, prefix = this.prefix === true ? action : this.prefix; $.each(this, function (key, value) { if ($.type(value) === 'string' && value.charAt(0) === '@') { settings[key] = options[ - value.slice(1) || prefix ? prefix + - key.charAt(0).toUpperCase() + key.slice(1) : key + value.slice(1) || (prefix ? prefix + + key.charAt(0).toUpperCase() + key.slice(1) : key) ]; } else { settings[key] = value; } + }); processQueue.push(settings); }); From 851bc2bd3fa26c03809187f3a4da4ebbee722dfc Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 12 Jun 2013 04:48:35 -0500 Subject: [PATCH 189/759] Don't try to parse meta data of the test dummy objects. --- test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index ecdea0e20..e3dcab850 100644 --- a/test/test.js +++ b/test/test.js @@ -1201,7 +1201,7 @@ $(function () { .fileupload({ autoUpload: true, acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, - previewFileTypes: /none/, + disableImageMetaDataLoad: true, send: function (e, data) { strictEqual( sendIndex += 1, From 892ebaef7cf04014005e943d7be40ce94146c06b Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 12 Jun 2013 05:35:50 -0500 Subject: [PATCH 190/759] Disable image resizing on the demo for Android and Opera. Android and Opera actually support image resizing, but fail to send Blob objects via XHR requests. --- js/main.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/js/main.js b/js/main.js index a291435b1..eee045c40 100644 --- a/js/main.js +++ b/js/main.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload Plugin JS Example 8.0 + * jQuery File Upload Plugin JS Example 8.0.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2010, Sebastian Tschan @@ -9,8 +9,8 @@ * http://www.opensource.org/licenses/MIT */ -/*jslint nomen: true, unparam: true, regexp: true */ -/*global $, window, document */ +/*jslint nomen: true, regexp: true */ +/*global $, window, navigator */ $(function () { 'use strict'; @@ -37,7 +37,11 @@ $(function () { // Demo settings: $('#fileupload').fileupload('option', { url: '//jquery-file-upload.appspot.com/', - disableImageResize: false, + // 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 && navigator.userAgent), maxFileSize: 5000000, acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i }); @@ -62,7 +66,7 @@ $(function () { url: $('#fileupload').fileupload('option', 'url'), dataType: 'json', context: $('#fileupload')[0] - }).always(function (result) { + }).always(function () { $(this).removeClass('fileupload-processing'); }).done(function (result) { $(this).fileupload('option', 'done') From 6d05e8ff0b9d9e6b37ae84e82fff530ba5800ed0 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 12 Jun 2013 05:42:00 -0500 Subject: [PATCH 191/759] Updated jQuery UI widget version. --- js/vendor/jquery.ui.widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/vendor/jquery.ui.widget.js b/js/vendor/jquery.ui.widget.js index fd2948f50..2d370893a 100644 --- a/js/vendor/jquery.ui.widget.js +++ b/js/vendor/jquery.ui.widget.js @@ -1,5 +1,5 @@ /* - * jQuery UI Widget 1.10.1+amd + * jQuery UI Widget 1.10.3+amd * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013 jQuery Foundation and other contributors From a470fdcff40f11e7b21d88b6d33fc4a18e2018d6 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 12 Jun 2013 06:03:59 -0500 Subject: [PATCH 192/759] Disable image resizing on the Basic Plus and AngularJS demo for Android and Opera. --- basic-plus.html | 10 +++++++--- js/app.js | 11 ++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/basic-plus.html b/basic-plus.html index 5cb586de0..b7bea6fd0 100644 --- a/basic-plus.html +++ b/basic-plus.html @@ -1,7 +1,7 @@ - + - + - + - + @@ -46,7 +46,7 @@ jQuery File Upload