Convert an image to a dataURL


Is this possible?

I’m using an Image (BS4) at present to store the result of a photo from a camera, and it works nicely because I can make the Image responsive - the picture is scaled to fit my area.

When I use a Picture Box it will not scale the image, so you only see a small part of the picture.

So can I either:

  1. Convert an Image or Image (BS4) to a DataURL to POST to my database; or
  2. Is there a way to scale a picture from the camera (am ImageURI) to a picture box?



I was just using:

pb = PictureBox2.getContext("2d")

Chance it to:

pb = PictureBox2.getContext("2d")

And all is well - hope this helps someone else out.