| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5d4072c commit 9a0c3e4
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | { | |
| 2 | 2 | "name": "blueimp-load-image", | |
| 3 | - "version": "1.11.2", | ||
| 3 | + "version": "1.11.3", | ||
| 4 | 4 | "title": "JavaScript Load Image", | |
| 5 | 5 | "description": "JavaScript Load Image is a library to load images provided as File or Blob objects or via URL. It returns an optionally scaled and/or cropped HTML img or canvas element. It also provides a method to parse image meta data to extract Exif tags and thumbnails and to restore the complete image header after resizing.", | |
| 6 | 6 | "keywords": [ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | /* | |
| 2 | - * JavaScript Load Image Orientation 1.0.0 | ||
| 2 | + * JavaScript Load Image Orientation 1.0.1 | ||
| 3 | 3 | * https://github.com/blueimp/JavaScript-Load-Image | |
| 4 | 4 | * | |
| 5 | 5 | * Copyright 2013, Sebastian Tschan | |
@@ -38,7 +38,7 @@ | |||
| 38 | 38 | width = canvas.width, | |
| 39 | 39 | height = canvas.height, | |
| 40 | 40 | orientation = options.orientation; | |
| 41 | - if (!orientation) { | ||
| 41 | + if (!orientation || orientation > 8) { | ||
| 42 | 42 | return; | |
| 43 | 43 | } | |
| 44 | 44 | if (orientation > 4) { | |
@@ -88,11 +88,13 @@ | |||
| 88 | 88 | // Transforms coordinate and dimension options | |
| 89 | 89 | // based on the given orientation option: | |
| 90 | 90 | loadImage.getTransformedOptions = function (options) { | |
| 91 | - if (!options.orientation || options.orientation === 1) { | ||
| 91 | + var orientation = options.orientation, | ||
| 92 | + newOptions, | ||
| 93 | + i; | ||
| 94 | + if (!orientation || orientation > 8 || orientation === 1) { | ||
| 92 | 95 | return options; | |
| 93 | 96 | } | |
| 94 | - var newOptions = {}, | ||
| 95 | - i; | ||
| 97 | + newOptions = {}; | ||
| 96 | 98 | for (i in options) { | |
| 97 | 99 | if (options.hasOwnProperty(i)) { | |
| 98 | 100 | newOptions[i] = options[i]; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | { | |
| 2 | 2 | "name": "blueimp-load-image", | |
| 3 | - "version": "1.11.2", | ||
| 3 | + "version": "1.11.3", | ||
| 4 | 4 | "title": "JavaScript Load Image", | |
| 5 | 5 | "description": "JavaScript Load Image is a library to load images provided as File or Blob objects or via URL. It returns an optionally scaled and/or cropped HTML img or canvas element. It also provides a method to parse image meta data to extract Exif tags and thumbnails and to restore the complete image header after resizing.", | |
| 6 | 6 | "keywords": [ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | /* | |
| 2 | - * JavaScript Load Image Test 1.11.0 | ||
| 2 | + * JavaScript Load Image Test 1.11.1 | ||
| 3 | 3 | * https://github.com/blueimp/JavaScript-Load-Image | |
| 4 | 4 | * | |
| 5 | 5 | * Copyright 2011, Sebastian Tschan | |
@@ -352,6 +352,22 @@ | |||
| 352 | 352 | }, {orientation: 7, right: 30, top: 20})).to.be.ok(); | |
| 353 | 353 | }); | |
| 354 | 354 | ||
| 355 | + it('Should ignore too small orientation value', function (done) { | ||
| 356 | + expect(loadImage(blobGIF, function (img) { | ||
| 357 | + done(); | ||
| 358 | + expect(img.width).to.be(80); | ||
| 359 | + expect(img.height).to.be(60); | ||
| 360 | + }, {orientation: -1})).to.be.ok(); | ||
| 361 | + }); | ||
| 362 | + | ||
| 363 | + it('Should ignore too large orientation value', function (done) { | ||
| 364 | + expect(loadImage(blobGIF, function (img) { | ||
| 365 | + done(); | ||
| 366 | + expect(img.width).to.be(80); | ||
| 367 | + expect(img.height).to.be(60); | ||
| 368 | + }, {orientation: 9})).to.be.ok(); | ||
| 369 | + }); | ||
| 370 | + | ||
| 355 | 371 | }); | |
| 356 | 372 | ||
| 357 | 373 | describe('Canvas', function () { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments