1

Is it possible in Javascript/JQuery to get the base64 image data from an image on the page?

For example is there a function like...

<img id="foo" src="https://mywebsite.com/bar.png">

<script>
   var base64Data = $('#foo').base64();
</script>
sazr
  • 24,984
  • 66
  • 194
  • 362
  • no there isn't one that simple - I think you'll need to use a canvas – Bravo Jul 17 '21 at 04:39
  • of course, since the image comes from your own server, why not do the base64 encoding there - to be honest, why do you need the base64 encoding anyway? – Bravo Jul 17 '21 at 04:46
  • 1
    Does this answer your question? [CONVERT Image url to Base64](https://stackoverflow.com/questions/22172604/convert-image-url-to-base64) – BadPiggie Jul 17 '21 at 04:52

0 Answers0