Skip to content

Commit 45e8eba

Browse files
committed
Update all libraries. Add full version of load-image
1 parent 8cd2384 commit 45e8eba

18 files changed

+1420
-312
lines changed
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
//=require jquery-fileupload/vendor/jquery.ui.widget
2-
//=require jquery-fileupload/vendor/load-image
2+
//=require jquery-fileupload/vendor/load-image/load-image
33
//=require jquery-fileupload/vendor/canvas-to-blob
44
//=require jquery-fileupload/vendor/tmpl
55
//=require jquery-fileupload/jquery.iframe-transport
66
//=require jquery-fileupload/jquery.fileupload
7-
//=require jquery-fileupload/jquery.fileupload-fp
87
//=require jquery-fileupload/jquery.fileupload-ui
9-
//=require jquery-fileupload/locale

app/assets/javascripts/jquery-fileupload/jquery.fileupload-angular.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload AngularJS Plugin 1.4.4
2+
* jQuery File Upload AngularJS Plugin 1.4.5
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2013, Sebastian Tschan
@@ -363,13 +363,15 @@
363363

364364
.directive('fileUpload', function () {
365365
return {
366-
controller: 'FileUploadController'
366+
controller: 'FileUploadController',
367+
scope: true
367368
};
368369
})
369370

370371
.directive('fileUploadProgress', function () {
371372
return {
372-
controller: 'FileUploadProgressController'
373+
controller: 'FileUploadProgressController',
374+
scope: true
373375
};
374376
})
375377

app/assets/javascripts/jquery-fileupload/jquery.fileupload-fp.js

Lines changed: 0 additions & 227 deletions
This file was deleted.

app/assets/javascripts/jquery-fileupload/jquery.fileupload-image.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload Image Preview & Resize Plugin 1.2.3
2+
* jQuery File Upload Image Preview & Resize Plugin 1.3.0
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2013, Sebastian Tschan
@@ -64,6 +64,7 @@
6464
minWidth: '@',
6565
minHeight: '@',
6666
crop: '@',
67+
orientation: '@',
6768
disabled: '@disableImageResize'
6869
},
6970
{
@@ -109,6 +110,9 @@
109110
imageMaxWidth: 1920,
110111
// The maximum height of resized images:
111112
imageMaxHeight: 1080,
113+
// Defines the image orientation (1-8) or takes the orientation
114+
// value from Exif data if set to true:
115+
imageOrientation: false,
112116
// Define if resized images should be cropped or only scaled:
113117
imageCrop: false,
114118
// Disable the resize image functionality by default:
@@ -131,7 +135,7 @@
131135
processActions: {
132136

133137
// Loads the image given via data.files and data.index
134-
// as img element if the browser supports canvas.
138+
// as img element, if the browser supports the File API.
135139
// Accepts the options fileTypes (regular expression)
136140
// and maxFileSize (integer) to limit the files to load:
137141
loadImage: function (data, options) {
@@ -162,22 +166,26 @@
162166

163167
// Resizes the image given as data.canvas or data.img
164168
// and updates data.canvas or data.img with the resized image.
169+
// Also stores the resized image as preview property.
165170
// Accepts the options maxWidth, maxHeight, minWidth,
166171
// minHeight, canvas and crop:
167172
resizeImage: function (data, options) {
168173
if (options.disabled) {
169174
return data;
170175
}
176+
options = $.extend({canvas: true}, options);
171177
var that = this,
172178
dfd = $.Deferred(),
179+
img = (options.canvas && data.canvas) || data.img,
173180
resolve = function (newImg) {
174-
data[newImg.getContext ? 'canvas' : 'img'] = newImg;
181+
if (newImg && (newImg.width !== img.width ||
182+
newImg.height !== img.height)) {
183+
data[newImg.getContext ? 'canvas' : 'img'] = newImg;
184+
}
185+
data.preview = newImg;
175186
dfd.resolveWith(that, [data]);
176187
},
177-
thumbnail,
178-
img,
179-
newImg;
180-
options = $.extend({canvas: true}, options);
188+
thumbnail;
181189
if (data.exif) {
182190
if (options.orientation === true) {
183191
options.orientation = data.exif.get('Orientation');
@@ -190,14 +198,9 @@
190198
}
191199
}
192200
}
193-
img = (options.canvas && data.canvas) || data.img;
194201
if (img) {
195-
newImg = loadImage.scale(img, options);
196-
if (newImg.width !== img.width ||
197-
newImg.height !== img.height) {
198-
resolve(newImg);
199-
return dfd.promise();
200-
}
202+
resolve(loadImage.scale(img, options));
203+
return dfd.promise();
201204
}
202205
return data;
203206
},
@@ -278,9 +281,8 @@
278281
// Sets the resized version of the image as a property of the
279282
// file object, must be called after "saveImage":
280283
setImage: function (data, options) {
281-
var img = data.canvas || data.img;
282-
if (img && !options.disabled) {
283-
data.files[data.index][options.name || 'preview'] = img;
284+
if (data.preview && !options.disabled) {
285+
data.files[data.index][options.name || 'preview'] = data.preview;
284286
}
285287
return data;
286288
}

0 commit comments

Comments
 (0)