Skip to content

Commit

Permalink
Fixed #998
Browse files Browse the repository at this point in the history
  • Loading branch information
Danial Farid authored and Danial Farid committed Oct 20, 2015
1 parent 5ed2c68 commit 0aecee7
Show file tree
Hide file tree
Showing 18 changed files with 101 additions and 91 deletions.
2 changes: 1 addition & 1 deletion demo/src/main/webapp/js/FileAPI.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 18 additions & 16 deletions demo/src/main/webapp/js/ng-file-upload-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* progress, resize, thumbnail, preview, validation and CORS
* FileAPI Flash shim for old browsers not supporting FormData
* @author Danial <[email protected]>
* @version 9.0.16
* @version 9.0.17
*/

(function () {
Expand Down Expand Up @@ -427,7 +427,7 @@ if (!window.FileReader) {
* AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
* progress, resize, thumbnail, preview, validation and CORS
* @author Danial <[email protected]>
* @version 9.0.16
* @version 9.0.17
*/

if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
Expand All @@ -448,7 +448,7 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {

var ngFileUpload = angular.module('ngFileUpload', []);

ngFileUpload.version = '9.0.16';
ngFileUpload.version = '9.0.17';

ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
var upload = this;
Expand Down Expand Up @@ -907,6 +907,8 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', 'UploadResize'

attr.$$ngfPrevFiles = files;

if (keepResult.keep && !newFiles.length) return;

if (upload.validate(newFiles, ngModel, attr, scope, function () {
if (noDelay) {
update(files, [], newFiles, dupFiles, isSingleModel);
Expand Down Expand Up @@ -1808,19 +1810,6 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
ngFileUpload.service('UploadResize', ['UploadValidate', '$q', '$timeout', function (UploadValidate, $q, $timeout) {
var upload = UploadValidate;

// add name getter to the blob constructor prototype
if (window.Object && Object.defineProperty) {
Object.defineProperty(Blob.prototype, 'name', {
get: function () {
return this.$ngfName;
},
set: function (v) {
this.$ngfName = v;
},
configurable: true
});
}

/**
* Conserve aspect ratio of the original region. Useful when shrinking/enlarging
* images to fit into a certain area.
Expand Down Expand Up @@ -1887,6 +1876,19 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', '$timeout', functi
return window.atob && elem.getContext && elem.getContext('2d');
};

if (upload.isResizeSupported()) {
// add name getter to the blob constructor prototype
Object.defineProperty(Blob.prototype, 'name', {
get: function () {
return this.$ngfName;
},
set: function (v) {
this.$ngfName = v;
},
configurable: true
});
}

upload.resize = function (file, width, height, quality) {
var deferred = $q.defer();
if (file.type.indexOf('image') !== 0) {
Expand Down
4 changes: 2 additions & 2 deletions demo/src/main/webapp/js/ng-file-upload-all.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/src/main/webapp/js/ng-file-upload-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* progress, resize, thumbnail, preview, validation and CORS
* FileAPI Flash shim for old browsers not supporting FormData
* @author Danial <[email protected]>
* @version 9.0.16
* @version 9.0.17
*/

(function () {
Expand Down
2 changes: 1 addition & 1 deletion demo/src/main/webapp/js/ng-file-upload-shim.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 17 additions & 15 deletions demo/src/main/webapp/js/ng-file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
* progress, resize, thumbnail, preview, validation and CORS
* @author Danial <[email protected]>
* @version 9.0.16
* @version 9.0.17
*/

if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
Expand All @@ -23,7 +23,7 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {

var ngFileUpload = angular.module('ngFileUpload', []);

ngFileUpload.version = '9.0.16';
ngFileUpload.version = '9.0.17';

ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
var upload = this;
Expand Down Expand Up @@ -482,6 +482,8 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', 'UploadResize'

attr.$$ngfPrevFiles = files;

if (keepResult.keep && !newFiles.length) return;

if (upload.validate(newFiles, ngModel, attr, scope, function () {
if (noDelay) {
update(files, [], newFiles, dupFiles, isSingleModel);
Expand Down Expand Up @@ -1383,19 +1385,6 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
ngFileUpload.service('UploadResize', ['UploadValidate', '$q', '$timeout', function (UploadValidate, $q, $timeout) {
var upload = UploadValidate;

// add name getter to the blob constructor prototype
if (window.Object && Object.defineProperty) {
Object.defineProperty(Blob.prototype, 'name', {
get: function () {
return this.$ngfName;
},
set: function (v) {
this.$ngfName = v;
},
configurable: true
});
}

/**
* Conserve aspect ratio of the original region. Useful when shrinking/enlarging
* images to fit into a certain area.
Expand Down Expand Up @@ -1462,6 +1451,19 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', '$timeout', functi
return window.atob && elem.getContext && elem.getContext('2d');
};

if (upload.isResizeSupported()) {
// add name getter to the blob constructor prototype
Object.defineProperty(Blob.prototype, 'name', {
get: function () {
return this.$ngfName;
},
set: function (v) {
this.$ngfName = v;
},
configurable: true
});
}

upload.resize = function (file, width, height, quality) {
var deferred = $q.defer();
if (file.type.indexOf('image') !== 0) {
Expand Down
4 changes: 2 additions & 2 deletions demo/src/main/webapp/js/ng-file-upload.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/FileAPI.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 18 additions & 16 deletions dist/ng-file-upload-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* progress, resize, thumbnail, preview, validation and CORS
* FileAPI Flash shim for old browsers not supporting FormData
* @author Danial <[email protected]>
* @version 9.0.16
* @version 9.0.17
*/

(function () {
Expand Down Expand Up @@ -427,7 +427,7 @@ if (!window.FileReader) {
* AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
* progress, resize, thumbnail, preview, validation and CORS
* @author Danial <[email protected]>
* @version 9.0.16
* @version 9.0.17
*/

if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
Expand All @@ -448,7 +448,7 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {

var ngFileUpload = angular.module('ngFileUpload', []);

ngFileUpload.version = '9.0.16';
ngFileUpload.version = '9.0.17';

ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
var upload = this;
Expand Down Expand Up @@ -907,6 +907,8 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', 'UploadResize'

attr.$$ngfPrevFiles = files;

if (keepResult.keep && !newFiles.length) return;

if (upload.validate(newFiles, ngModel, attr, scope, function () {
if (noDelay) {
update(files, [], newFiles, dupFiles, isSingleModel);
Expand Down Expand Up @@ -1808,19 +1810,6 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
ngFileUpload.service('UploadResize', ['UploadValidate', '$q', '$timeout', function (UploadValidate, $q, $timeout) {
var upload = UploadValidate;

// add name getter to the blob constructor prototype
if (window.Object && Object.defineProperty) {
Object.defineProperty(Blob.prototype, 'name', {
get: function () {
return this.$ngfName;
},
set: function (v) {
this.$ngfName = v;
},
configurable: true
});
}

/**
* Conserve aspect ratio of the original region. Useful when shrinking/enlarging
* images to fit into a certain area.
Expand Down Expand Up @@ -1887,6 +1876,19 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', '$timeout', functi
return window.atob && elem.getContext && elem.getContext('2d');
};

if (upload.isResizeSupported()) {
// add name getter to the blob constructor prototype
Object.defineProperty(Blob.prototype, 'name', {
get: function () {
return this.$ngfName;
},
set: function (v) {
this.$ngfName = v;
},
configurable: true
});
}

upload.resize = function (file, width, height, quality) {
var deferred = $q.defer();
if (file.type.indexOf('image') !== 0) {
Expand Down
4 changes: 2 additions & 2 deletions dist/ng-file-upload-all.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ng-file-upload-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* progress, resize, thumbnail, preview, validation and CORS
* FileAPI Flash shim for old browsers not supporting FormData
* @author Danial <[email protected]>
* @version 9.0.16
* @version 9.0.17
*/

(function () {
Expand Down
Loading

0 comments on commit 0aecee7

Please sign in to comment.