1.0.0 • Published 7 years ago

@petitchevalroux/size-attribute-to-img v1.0.0

Weekly downloads
1
License
GPL-3.0
Repository
github
Last release
7 years ago

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">