VinceG / vue-web-cam

Webcam component for VueJs.
MIT License
257 stars 110 forks source link

base64 is invalid #52

Closed skuzzymiglet closed 4 years ago

skuzzymiglet commented 4 years ago

Running atob on capture returns an error DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.

skuzzymiglet commented 4 years ago

Sorry, I was taking everything incl the content type

miketeix commented 4 years ago

@skuzzymiglet i just had this issue today, but couldn't remedy the situation. I'm wondering what worked for you? I.e. How much of data:image/jpeg;base64,/9j/4AAQSk... did you slice?

I tried removing data:, image/jpeg; and base64, and combinations of them with no luck.

miketeix commented 4 years ago

I realized that the returned value is actually a dataUri that happens to be base64 encoded. Once I knew that, I was able to convert to Blob.

Perhaps the READ.ME could be updated to:

Methods

name param notes
capture void Capture the current image through the webcam as base64 encoded dataUri