1

I'm trying to get the base64 string of an image using only javascript.

This has to work only on firefox 3.5+ since it's a greasemonkey script.

I can't use the canvas workaround since it's on a another server and this throws a security exception.

Thanks for any idea.

2 Answers 2

3

Maybe there's a more elegant solution but you can create a canvas with the dimensions of your image, use drawImage to put your image on the canvas, use toDataURL with the MIME type that you want and get a data: URL which will be something like "data:image/png;base64," and then the base64 representation of the image in a given format.

Oh, I've just read that it's on another server. Then you can't have the base64. Sorry. The only information you can get are the dimensions.

Sign up to request clarification or add additional context in comments.

Comments

-1

base64.js is what you are looking for

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.