KO
|
EN
gitlite — search
Search
#python
#java
#python3
#arduino
#golang
#machine-learning
#rust
#html
#flask
#javascript
#seismology
#nodejs
load-img
★ 10
Open GitHub ↗
loads a Image for the browser
Download README (.md)
Explore Similar Repositories
filmaffinity-gem
:
Easy access to Filmaffinity data
graph-extract
:
Small library for extracting values from graphs
zenkins
:
No description available.
certPinningVulnerableOkHttp
:
OkHttp sample app vulnerable to CVE-2016-2402
rf.nim
:
(Experimental) ReactiveX-like reactive programming library designed for Nim
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
load-img
?
Download (.md)
# load-img [](http://github.com/badges/stability-badges) Creates a new `<img>` element for the browser and provides an error-first callback for load completion. This module has been adapted from Azer's unpublished [img](https://www.npmjs.com/package/img) module, which was updated with dubious code by another author. ## Install ```sh npm install load-img --save ``` ## Example ```js const loadImage = require('load-img'); loadImage('images/foo.png', (err, img) => { if (err) throw err; console.log(img.width, img.height); }); ``` ## Usage [](https://www.npmjs.com/package/load-img) #### `img = loadImage(src, [opt], [cb])` Creates a new `<img>` element with the given `src` property. The other parameters are optional. You can pass `opt`, an object containing `{ crossOrigin }` string. `cb` is a function receiving the `onload` or `onerror` event. This function returns the created `img` element. Example with `crossOrigin`: ```js const loadImage = require('load-img'); loadImage('images/foo.png', { crossOrigin: 'Anonymous' }, (err, img) => { if (err) throw err; document.body.appendChild(img); }); ``` ## License MIT, see [LICENSE.md](http://github.com/mattdesl/load-img/blob/master/LICENSE.md) for details.