@petitchevalroux/size-attribute-to-img

1.0.0 • Public • Published

node-size-attribute-to-img

Add width and height attribute to img html tag.

Support base64 Data-URI and https? src attribute

Usage

const SizeAttributeToImg = require("@petitchevalroux/size-attribute-to-img"),
converter = new SizeAttributeToImg();
converter
    .add("<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==\">")
    .then(html=>{
        console.log(html);
    })

Output

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==" width="1" height="1">

Readme

Keywords

none

Package Sidebar

Install

npm i @petitchevalroux/size-attribute-to-img

Weekly Downloads

0

Version

1.0.0

License

GPL-3.0

Unpacked Size

75.4 kB

Total Files

14

Last publish

Collaborators

  • petitchevalroux