Skip to content

Commit f7ed1c1

Browse files
committed
Merge remote-tracking branch 'powmedia/master'
Conflicts: README.md package.json
2 parents 3ddac4f + 2b0b001 commit f7ed1c1

File tree

7 files changed

+31
-19
lines changed

7 files changed

+31
-19
lines changed

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
[JavaScript Load Image Demo](https://blueimp.github.io/JavaScript-Load-Image/)
2424

2525
## Description
26-
JavaScript Load Image is a library to load images provided as File or Blob objects or via URL.
27-
It returns an optionally scaled and/or cropped HTML img or canvas element via an asynchronous callback.
26+
JavaScript Load Image is a library to load images provided as File or Blob objects or via URL.
27+
It returns an optionally scaled and/or cropped HTML img or canvas element via an asynchronous callback.
2828
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.
2929

3030
## Setup
@@ -80,7 +80,7 @@ However, JavaScript Load Image is a very suitable complement to the [Canvas to B
8080
## API
8181
The **loadImage()** function accepts a [File](https://developer.mozilla.org/en/DOM/File) or [Blob](https://developer.mozilla.org/en/DOM/Blob) object or a simple image URL (e.g. `'https://example.org/image.png'`) as first argument.
8282

83-
If a [File](https://developer.mozilla.org/en/DOM/File) or [Blob](https://developer.mozilla.org/en/DOM/Blob) is passed as parameter, it returns a HTML **img** element if the browser supports the [URL](https://developer.mozilla.org/en/DOM/window.URL) API or a [FileReader](https://developer.mozilla.org/en/DOM/FileReader) object if supported, or **false**.
83+
If a [File](https://developer.mozilla.org/en/DOM/File) or [Blob](https://developer.mozilla.org/en/DOM/Blob) is passed as parameter, it returns a HTML **img** element if the browser supports the [URL](https://developer.mozilla.org/en/DOM/window.URL) API or a [FileReader](https://developer.mozilla.org/en/DOM/FileReader) object if supported, or **false**.
8484
It always returns a HTML [img](https://developer.mozilla.org/en/docs/HTML/Element/Img) element when passing an image URL:
8585

8686
```js
@@ -137,27 +137,27 @@ The optional third argument to **loadImage()** is a map of options:
137137
* **maxHeight**: Defines the maximum height of the img/canvas element.
138138
* **minWidth**: Defines the minimum width of the img/canvas element.
139139
* **minHeight**: Defines the minimum height of the img/canvas element.
140-
* **sourceWidth**: The width of the sub-rectangle of the source image to draw into the destination canvas.
140+
* **sourceWidth**: The width of the sub-rectangle of the source image to draw into the destination canvas.
141141
Defaults to the source image width and requires *canvas: true*.
142-
* **sourceHeight**: The height of the sub-rectangle of the source image to draw into the destination canvas.
142+
* **sourceHeight**: The height of the sub-rectangle of the source image to draw into the destination canvas.
143143
Defaults to the source image height and requires *canvas: true*.
144-
* **top**: The top margin of the sub-rectangle of the source image.
144+
* **top**: The top margin of the sub-rectangle of the source image.
145145
Defaults to *0* and requires *canvas: true*.
146-
* **right**: The right margin of the sub-rectangle of the source image.
146+
* **right**: The right margin of the sub-rectangle of the source image.
147147
Defaults to *0* and requires *canvas: true*.
148-
* **bottom**: The bottom margin of the sub-rectangle of the source image.
148+
* **bottom**: The bottom margin of the sub-rectangle of the source image.
149149
Defaults to *0* and requires *canvas: true*.
150-
* **left**: The left margin of the sub-rectangle of the source image.
150+
* **left**: The left margin of the sub-rectangle of the source image.
151151
Defaults to *0* and requires *canvas: true*.
152-
* **contain**: Scales the image up/down to contain it in the max dimensions if set to *true*.
152+
* **contain**: Scales the image up/down to contain it in the max dimensions if set to *true*.
153153
This emulates the CSS feature [background-image: contain](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Scaling_background_images#contain).
154-
* **cover**: Scales the image up/down to cover the max dimensions with the image dimensions if set to *true*.
154+
* **cover**: Scales the image up/down to cover the max dimensions with the image dimensions if set to *true*.
155155
This emulates the CSS feature [background-image: cover](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Scaling_background_images#cover).
156-
* **aspectRatio**: Crops the image to the given aspect ratio (e.g. `16/9`).
156+
* **aspectRatio**: Crops the image to the given aspect ratio (e.g. `16/9`).
157157
This feature assumes *crop: true*.
158-
* **crop**: Crops the image to the maxWidth/maxHeight constraints if set to *true*.
158+
* **crop**: Crops the image to the maxWidth/maxHeight constraints if set to *true*.
159159
This feature assumes *canvas: true*.
160-
* **orientation**: Allows to transform the canvas coordinates according to the EXIF orientation specification.
160+
* **orientation**: Allows to transform the canvas coordinates according to the EXIF orientation specification.
161161
This feature assumes *canvas: true*.
162162
* **canvas**: Returns the image as [canvas](https://developer.mozilla.org/en/HTML/Canvas) element if set to *true*.
163163
* **crossOrigin**: Sets the crossOrigin property on the img element for loading [CORS enabled images](https://developer.mozilla.org/en-US/docs/HTML/CORS_Enabled_Image).
@@ -184,7 +184,7 @@ loadImage(
184184
All settings are optional. By default, the image is returned as HTML **img** element without any image size restrictions.
185185

186186
## Meta data parsing
187-
If the Load Image Meta extension is included, it is also possible to parse image meta data.
187+
If the Load Image Meta extension is included, it is also possible to parse image meta data.
188188
The extension provides the method **loadImage.parseMetaData**, which can be used the following way:
189189

190190
```js
@@ -212,11 +212,11 @@ loadImage.parseMetaData(
212212

213213
The third argument is an options object which defines the maximum number of bytes to parse for the image meta data, allows to disable the imageHead creation and is also passed along to segment parsers registered via loadImage extensions, e.g. the Exif parser.
214214

215-
**Note:**
215+
**Note:**
216216
Blob objects of resized images can be created via [canvas.toBlob()](https://github.com/blueimp/JavaScript-Canvas-to-Blob).
217217

218218
### Exif parser
219-
If you include the Load Image Exif Parser extension, the **parseMetaData** callback **data** contains the additional property **exif** if Exif data could be found in the given image.
219+
If you include the Load Image Exif Parser extension, the **parseMetaData** callback **data** contains the additional property **exif** if Exif data could be found in the given image.
220220
The **exif** object stores the parsed Exif tags:
221221

222222
```js
@@ -229,7 +229,7 @@ It also provides an **exif.get()** method to retrieve the tag value via the tag'
229229
var orientation = data.exif.get('Orientation');
230230
```
231231

232-
By default, the only available mapped names are **Orientation** and **Thumbnail**.
232+
By default, the only available mapped names are **Orientation** and **Thumbnail**.
233233
If you also include the Load Image Exif Map library, additional tag mappings become available, as well as two additional methods, **exif.getText()** and **exif.getAll()**:
234234

235235
```js
@@ -247,7 +247,7 @@ The Exif parser also adds additional options for the parseMetaData method, to di
247247
* **disableExifGps**: Disables parsing of the Exif GPS Info IFD.
248248

249249
## iOS scaling fixes
250-
Scaling megapixel images in iOS (iPhone, iPad, iPod) can result in distorted (squashed) images.
250+
Scaling megapixel images in iOS (iPhone, iPad, iPod) can result in distorted (squashed) images.
251251
The Load Image iOS scaling fixes extension resolves these issues.
252252

253253
## License

js/load-image-exif-map.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
if (typeof define === 'function' && define.amd) {
2020
// Register as an anonymous AMD module:
2121
define(['load-image', 'load-image-exif'], factory);
22+
} else if (typeof module !== 'undefined' && module.exports) {
23+
factory(require('./load-image'), require('./load-image-exif'));
2224
} else {
2325
// Browser globals:
2426
factory(window.loadImage);

js/load-image-exif.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
if (typeof define === 'function' && define.amd) {
1818
// Register as an anonymous AMD module:
1919
define(['load-image', 'load-image-meta'], factory);
20+
} else if (typeof module !== 'undefined' && module.exports) {
21+
factory(require('./load-image'), require('./load-image-meta'));
2022
} else {
2123
// Browser globals:
2224
factory(window.loadImage);

js/load-image-ios.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
if (typeof define === 'function' && define.amd) {
2121
// Register as an anonymous AMD module:
2222
define(['load-image'], factory);
23+
} else if (typeof module !== 'undefined' && module.exports) {
24+
factory(require('./load-image'));
2325
} else {
2426
// Browser globals:
2527
factory(window.loadImage);

js/load-image-meta.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
if (typeof define === 'function' && define.amd) {
2222
// Register as an anonymous AMD module:
2323
define(['load-image'], factory);
24+
} else if (typeof module !== 'undefined' && module.exports) {
25+
factory(require('./load-image'));
2426
} else {
2527
// Browser globals:
2628
factory(window.loadImage);

js/load-image-orientation.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
if (typeof define === 'function' && define.amd) {
1717
// Register as an anonymous AMD module:
1818
define(['load-image'], factory);
19+
} else if (typeof module !== 'undefined' && module.exports) {
20+
factory(require('./load-image'));
1921
} else {
2022
// Browser globals:
2123
factory(window.loadImage);

js/load-image.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@
295295
define(function () {
296296
return loadImage;
297297
});
298+
} else if (typeof module !== 'undefined' && module.exports) {
299+
module.exports = loadImage;
298300
} else {
299301
$.loadImage = loadImage;
300302
}

0 commit comments

Comments
 (0)