mercredi 22 juillet 2020

How to shorten dataurl or convert it back to png in JavaScript

With dataurl, there can be a long length of strings. It seems to be inconvenient for me. For example:

<img src="data:image/png;base64,iVBORw0KGgoAAAKNSF843jSNDSDklMFSFASFASLKMFSAF9033lkmdfsADGA...">

Is there a way I can shorten this length of the data url or convert it to into a png so the length of the src is manageable in Javascript?

For example, my desired result:

<img src="data:image/png;base64,iVB">
or
<img src="image.png">



Aucun commentaire:

Enregistrer un commentaire