@@ -164,20 +164,20 @@ following two
164
164
#### Function signature
165
165
166
166
The ` loadImage() ` function accepts a
167
- [ File] ( https://developer.mozilla.org/en/DOM /File ) or
168
- [ Blob] ( https://developer.mozilla.org/en/DOM/ Blob ) object or an image URL as
169
- first argument.
167
+ [ File] ( https://developer.mozilla.org/en-US/docs/Web/API /File ) or
168
+ [ Blob] ( https://developer.mozilla.org/en-US/docs/Web/API/ Blob ) object or an image
169
+ URL as first argument.
170
170
171
- If a [ File] ( https://developer.mozilla.org/en/DOM /File ) or
172
- [ Blob] ( https://developer.mozilla.org/en/DOM/ Blob ) is passed as parameter, it
173
- returns an HTML ` img ` element if the browser supports the
174
- [ URL] ( https://developer.mozilla.org/en/DOM/window. URL ) API, alternatively a
175
- [ FileReader] ( https://developer.mozilla.org/en/DOM/ FileReader ) object if the
176
- ` FileReader ` API is supported, or ` false ` .
171
+ If a [ File] ( https://developer.mozilla.org/en-US/docs/Web/API /File ) or
172
+ [ Blob] ( https://developer.mozilla.org/en-US/docs/Web/API/ Blob ) is passed as
173
+ parameter, it returns an HTML ` img ` element if the browser supports the
174
+ [ URL] ( https://developer.mozilla.org/en-US/docs/Web/API/ URL ) API, alternatively a
175
+ [ FileReader] ( https://developer.mozilla.org/en-US/docs/Web/API/ FileReader ) object
176
+ if the ` FileReader ` API is supported, or ` false ` .
177
177
178
178
It always returns an HTML
179
- [ img] ( https://developer.mozilla.org/en/docs/HTML/Element/Img ) element when
180
- passing an image URL:
179
+ [ img] ( https://developer.mozilla.org/en-US /docs/Web/ HTML/Element/Img ) element
180
+ when passing an image URL:
181
181
182
182
``` js
183
183
var loadingImage = loadImage (
@@ -192,9 +192,9 @@ var loadingImage = loadImage(
192
192
#### Canceling event handling
193
193
194
194
The ` img ` element or
195
- [ FileReader] ( https://developer.mozilla.org/en/DOM/ FileReader ) object returned by
196
- the ` loadImage() ` function allows to cancel event handling by setting the
197
- ` onload ` and ` onerror ` event handlers to null:
195
+ [ FileReader] ( https://developer.mozilla.org/en-US/docs/Web/API/ FileReader ) object
196
+ returned by the ` loadImage() ` function allows to cancel event handling by
197
+ setting the ` onload ` and ` onerror ` event handlers to null:
198
198
199
199
``` js
200
200
var loadingImage = loadImage (
@@ -218,9 +218,11 @@ occurred while loading the image.
218
218
The callback function is passed two arguments:
219
219
220
220
1 . An HTML [ img] ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img )
221
- element or [ canvas] ( https://developer.mozilla.org/en/HTML/Canvas ) element, or
222
- an [ Event] ( https://developer.mozilla.org/en/DOM/event ) object of type
223
- ` error ` .
221
+ element or
222
+ [ canvas] ( https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API )
223
+ element, or an
224
+ [ Event] ( https://developer.mozilla.org/en-US/docs/Web/API/Event ) object of
225
+ type ` error ` .
224
226
2 . An object with the original image dimensions as properties and potentially
225
227
additional [ metadata] ( #metadata-parsing ) .
226
228
@@ -278,15 +280,16 @@ The `Promise` resolves with an object with the following properties:
278
280
279
281
- ` image ` : An HTML
280
282
[ img] ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img ) or
281
- [ canvas] ( https://developer.mozilla.org/en/HTML/Canvas ) element.
283
+ [ canvas] ( https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API ) element.
282
284
- ` originalWidth ` : The original width of the image.
283
285
- ` originalHeight ` : The original height of the image.
284
286
285
287
If [ metadata] ( #metadata-parsing ) has been parsed, additional properties might be
286
288
present on the object.
287
289
288
290
If image loading fails, the ` Promise ` rejects with an
289
- [ Event] ( https://developer.mozilla.org/en/DOM/event ) object of type ` error ` .
291
+ [ Event] ( https://developer.mozilla.org/en-US/docs/Web/API/Event ) object of type
292
+ ` error ` .
290
293
291
294
## Options
292
295
@@ -380,14 +383,14 @@ Defaults to `0` and requires `canvas: true`.
380
383
381
384
Scales the image up/down to contain it in the max dimensions if set to ` true ` .
382
385
This emulates the CSS feature
383
- [ background-image: contain] ( https://developer.mozilla.org/en-US/docs/Web/Guide/ CSS/Scaling_background_images #contain ) .
386
+ [ background-image: contain] ( https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images #contain ) .
384
387
385
388
### cover
386
389
387
390
Scales the image up/down to cover the max dimensions with the image dimensions
388
391
if set to ` true ` .
389
392
This emulates the CSS feature
390
- [ background-image: cover] ( https://developer.mozilla.org/en-US/docs/Web/Guide/ CSS/Scaling_background_images #cover ) .
393
+ [ background-image: cover] ( https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images #cover ) .
391
394
392
395
### aspectRatio
393
396
@@ -487,24 +490,26 @@ callback function has additional properties (see
487
490
[ metadata parsing] ( #metadata-parsing ) ).
488
491
489
492
If the file is given as URL and the browser supports the
490
- [ fetch API] ( https://developer.mozilla.org/en/docs/Web/API/Fetch_API ) or the XHR
493
+ [ fetch API] ( https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API ) or the
494
+ XHR
491
495
[ responseType] ( https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType )
492
496
` blob ` , fetches the file as ` Blob ` to be able to parse the metadata.
493
497
494
498
### canvas
495
499
496
- Returns the image as [ canvas] ( https://developer.mozilla.org/en/HTML/Canvas )
497
- element if set to ` true ` .
500
+ Returns the image as
501
+ [ canvas] ( https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API ) element if
502
+ set to ` true ` .
498
503
499
504
### crossOrigin
500
505
501
506
Sets the ` crossOrigin ` property on the ` img ` element for loading
502
- [ CORS enabled images] ( https://developer.mozilla.org/en-US/docs/HTML/CORS_Enabled_Image ) .
507
+ [ CORS enabled images] ( https://developer.mozilla.org/en-US/docs/Web/ HTML/CORS_enabled_image ) .
503
508
504
509
### noRevoke
505
510
506
511
By default, the
507
- [ created object URL] ( https://developer.mozilla.org/en/DOM/window. URL. createObjectURL )
512
+ [ created object URL] ( https://developer.mozilla.org/en-US/docs/Web/API/ URL/ createObjectURL )
508
513
is revoked after the image has been loaded, except when this option is set to
509
514
` true ` .
510
515
@@ -937,6 +942,6 @@ The JavaScript Load Image library is released under the
937
942
- Original image metadata handling implemented with the help and contribution of
938
943
Achim Stöhr.
939
944
- Original Exif tags mapping based on Jacob Seidelin's
940
- [ exif-js] ( https://github.com/jseidelin /exif-js ) library.
945
+ [ exif-js] ( https://github.com/exif-js /exif-js ) library.
941
946
- Original IPTC parser implementation by
942
947
[ Dave Bevan] ( https://github.com/bevand10 ) .
0 commit comments