From fae70bf0a7f1b566d25e30064f60d58ab150951a Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 7 May 2020 23:35:02 +0200 Subject: Revert "composer updates" This reverts commit dbfe748d274f6843fc91a3071df7be45c4ab5b00 --- .../js/jquery.fileupload-image.js | 80 +++++++++------------- 1 file changed, 32 insertions(+), 48 deletions(-) (limited to 'vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js') diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js index 859846103..8e9b46215 100644 --- a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js +++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js @@ -11,7 +11,7 @@ /* global define, require */ -(function (factory) { +(function(factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: @@ -21,7 +21,6 @@ 'load-image-meta', 'load-image-scale', 'load-image-exif', - 'load-image-orientation', 'canvas-to-blob', './jquery.fileupload-process' ], factory); @@ -33,7 +32,6 @@ require('blueimp-load-image/js/load-image-meta'), require('blueimp-load-image/js/load-image-scale'), require('blueimp-load-image/js/load-image-exif'), - require('blueimp-load-image/js/load-image-orientation'), require('blueimp-canvas-to-blob'), require('./jquery.fileupload-process') ); @@ -41,25 +39,18 @@ // Browser globals: factory(window.jQuery, window.loadImage); } -})(function ($, loadImage) { +})(function($, loadImage) { 'use strict'; // Prepend to the default processQueue: $.blueimp.fileupload.prototype.options.processQueue.unshift( { action: 'loadImageMetaData', - maxMetaDataSize: '@', disableImageHead: '@', - disableMetaDataParsers: '@', disableExif: '@', disableExifThumbnail: '@', - disableExifOffsets: '@', - includeExifTags: '@', - excludeExifTags: '@', - disableIptc: '@', - disableIptcOffsets: '@', - includeIptcTags: '@', - excludeIptcTags: '@', + disableExifSub: '@', + disableExifGps: '@', disabled: '@disableImageMetaDataLoad' }, { @@ -134,7 +125,7 @@ imageMaxHeight: 1080, // Defines the image orientation (1-8) or takes the orientation // value from Exif data if set to true: - imageOrientation: true, + imageOrientation: false, // Define if resized images should be cropped or only scaled: imageCrop: false, // Disable the resize image functionality by default: @@ -159,7 +150,7 @@ // as img element, if the browser supports the File API. // Accepts the options fileTypes (regular expression) // and maxFileSize (integer) to limit the files to load: - loadImage: function (data, options) { + loadImage: function(data, options) { if (options.disabled) { return data; } @@ -173,7 +164,7 @@ (options.fileTypes && !options.fileTypes.test(file.type)) || !loadImage( file, - function (img) { + function(img) { if (img.src) { data.img = img; } @@ -192,7 +183,7 @@ // Also stores the resized image as preview property. // Accepts the options maxWidth, maxHeight, minWidth, // minHeight, canvas and crop: - resizeImage: function (data, options) { + resizeImage: function(data, options) { if (options.disabled || !(data.canvas || data.img)) { return data; } @@ -202,7 +193,7 @@ // eslint-disable-next-line new-cap dfd = $.Deferred(), img = (options.canvas && data.canvas) || data.img, - resolve = function (newImg) { + resolve = function(newImg) { if ( newImg && (newImg.width !== img.width || @@ -214,24 +205,18 @@ data.preview = newImg; dfd.resolveWith(that, [data]); }, - thumbnail, - thumbnailBlob; + thumbnail; if (data.exif) { if (options.orientation === true) { options.orientation = data.exif.get('Orientation'); } if (options.thumbnail) { thumbnail = data.exif.get('Thumbnail'); - thumbnailBlob = thumbnail && thumbnail.get('Blob'); - if (thumbnailBlob) { - loadImage(thumbnailBlob, resolve, options); + if (thumbnail) { + loadImage(thumbnail, resolve, options); return dfd.promise(); } } - // Prevent orienting browser oriented images: - if (loadImage.orientation) { - data.orientation = data.orientation || options.orientation; - } // Prevent orienting the same image twice: if (data.orientation) { delete options.orientation; @@ -248,7 +233,7 @@ // Saves the processed image given as data.canvas // inplace at data.index of data.files: - saveImage: function (data, options) { + saveImage: function(data, options) { if (!data.canvas || options.disabled) { return data; } @@ -258,7 +243,7 @@ dfd = $.Deferred(); if (data.canvas.toBlob) { data.canvas.toBlob( - function (blob) { + function(blob) { if (!blob.name) { if (file.type === blob.type) { blob.name = file.name; @@ -287,7 +272,7 @@ return dfd.promise(); }, - loadImageMetaData: function (data, options) { + loadImageMetaData: function(data, options) { if (options.disabled) { return data; } @@ -296,7 +281,7 @@ dfd = $.Deferred(); loadImage.parseMetaData( data.files[data.index], - function (result) { + function(result) { $.extend(data, result); dfd.resolveWith(that, [data]); }, @@ -305,7 +290,7 @@ return dfd.promise(); }, - saveImageMetaData: function (data, options) { + saveImageMetaData: function(data, options) { if ( !( data.imageHead && @@ -316,32 +301,31 @@ ) { return data; } - var that = this, - file = data.files[data.index], - // eslint-disable-next-line new-cap - dfd = $.Deferred(); - if (data.orientation && data.exifOffsets) { - // Reset Exif Orientation data: - loadImage.writeExifData(data.imageHead, data, 'Orientation', 1); - } - loadImage.replaceHead(file, data.imageHead, function (blob) { - blob.name = file.name; - data.files[data.index] = blob; - dfd.resolveWith(that, [data]); - }); - return dfd.promise(); + var file = data.files[data.index], + blob = new Blob( + [ + data.imageHead, + // Resized images always have a head size of 20 bytes, + // 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) { + setImage: function(data, options) { if (data.preview && !options.disabled) { data.files[data.index][options.name || 'preview'] = data.preview; } return data; }, - deleteImageReferences: function (data, options) { + deleteImageReferences: function(data, options) { if (!options.disabled) { delete data.img; delete data.canvas; -- cgit v1.2.3