Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit c94cac8

Browse files
committed
Docs: Show original dimensions in callback data.
1 parent a08c357 commit c94cac8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,18 @@ The callback function is passed two arguments:
224224
2. An object with the original image dimensions as properties and potentially
225225
additional [metadata](#metadata-parsing).
226226

227+
```js
228+
loadImage(
229+
fileOrBlobOrUrl,
230+
function (img, data) {
231+
document.body.appendChild(img)
232+
console.log('Original image width: ', data.originalWidth)
233+
console.log('Original image height: ', data.originalHeight)
234+
},
235+
{ maxWidth: 600 }
236+
)
237+
```
238+
227239
#### Error handling
228240

229241
Example code implementing error handling:
@@ -236,8 +248,6 @@ loadImage(
236248
console.error('Error loading image file')
237249
} else {
238250
document.body.appendChild(img)
239-
console.log('Original image width: ', data.originalWidth)
240-
console.log('Original image height: ', data.originalHeight)
241251
}
242252
},
243253
{ maxWidth: 600 }

0 commit comments

Comments
 (0)