Skip to content

Commit 78da4b2

Browse files
committed
Docs: Update reference links.
1 parent f7bfa73 commit 78da4b2

File tree

2 files changed

+47
-34
lines changed

2 files changed

+47
-34
lines changed

README.md

+32-27
Original file line numberDiff line numberDiff line change
@@ -164,20 +164,20 @@ following two
164164
#### Function signature
165165

166166
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.
170170

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`.
177177

178178
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:
181181

182182
```js
183183
var loadingImage = loadImage(
@@ -192,9 +192,9 @@ var loadingImage = loadImage(
192192
#### Canceling event handling
193193

194194
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:
198198

199199
```js
200200
var loadingImage = loadImage(
@@ -218,9 +218,11 @@ occurred while loading the image.
218218
The callback function is passed two arguments:
219219

220220
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`.
224226
2. An object with the original image dimensions as properties and potentially
225227
additional [metadata](#metadata-parsing).
226228

@@ -278,15 +280,16 @@ The `Promise` resolves with an object with the following properties:
278280

279281
- `image`: An HTML
280282
[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.
282284
- `originalWidth`: The original width of the image.
283285
- `originalHeight`: The original height of the image.
284286

285287
If [metadata](#metadata-parsing) has been parsed, additional properties might be
286288
present on the object.
287289

288290
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`.
290293

291294
## Options
292295

@@ -380,14 +383,14 @@ Defaults to `0` and requires `canvas: true`.
380383

381384
Scales the image up/down to contain it in the max dimensions if set to `true`.
382385
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).
384387

385388
### cover
386389

387390
Scales the image up/down to cover the max dimensions with the image dimensions
388391
if set to `true`.
389392
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).
391394

392395
### aspectRatio
393396

@@ -487,24 +490,26 @@ callback function has additional properties (see
487490
[metadata parsing](#metadata-parsing)).
488491

489492
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
491495
[responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType)
492496
`blob`, fetches the file as `Blob` to be able to parse the metadata.
493497

494498
### canvas
495499

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`.
498503

499504
### crossOrigin
500505

501506
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).
503508

504509
### noRevoke
505510

506511
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)
508513
is revoked after the image has been loaded, except when this option is set to
509514
`true`.
510515

@@ -937,6 +942,6 @@ The JavaScript Load Image library is released under the
937942
- Original image metadata handling implemented with the help and contribution of
938943
Achim Stöhr.
939944
- 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.
941946
- Original IPTC parser implementation by
942947
[Dave Bevan](https://github.com/bevand10).

index.html

+15-7
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,19 @@ <h1>JavaScript Load Image Demo</h1>
3636
>JavaScript Load Image</a
3737
>
3838
is a library to load images provided as
39-
<a href="https://developer.mozilla.org/en/DOM/File">File</a> or
40-
<a href="https://developer.mozilla.org/en/DOM/Blob">Blob</a> objects or
41-
via URL.<br />
39+
<a href="https://developer.mozilla.org/en-US/docs/Web/API/File">File</a>
40+
or
41+
<a href="https://developer.mozilla.org/en-US/docs/Web/API/Blob">Blob</a>
42+
objects or via URL.<br />
4243
It returns an optionally <strong>scaled</strong>,
4344
<strong>cropped</strong> or <strong>rotated</strong> HTML
44-
<a href="https://developer.mozilla.org/en/docs/HTML/Element/Img">img</a>
45+
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Img"
46+
>img</a
47+
>
4548
or
46-
<a href="https://developer.mozilla.org/en/docs/HTML/Canvas">canvas</a>
49+
<a href="https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API"
50+
>canvas</a
51+
>
4752
element.
4853
</p>
4954
<p>
@@ -114,8 +119,11 @@ <h2>Result</h2>
114119
<figure id="result">
115120
<figcaption style="display: none;">
116121
This demo works only in browsers with support for the
117-
<a href="https://developer.mozilla.org/en/DOM/window.URL">URL</a> or
118-
<a href="https://developer.mozilla.org/en/DOM/FileReader">FileReader</a>
122+
<a href="https://developer.mozilla.org/en-US/docs/Web/API/URL">URL</a>
123+
or
124+
<a href="https://developer.mozilla.org/en-US/docs/Web/API/FileReader"
125+
>FileReader</a
126+
>
119127
API.
120128
</figcaption>
121129
</figure>

0 commit comments

Comments
 (0)