Skip to content

petitchevalroux/node-size-attribute-to-img

Repository files navigation

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

About

Add width and height attribute to img html tag

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published