0

I wrote a bookmarklet that find images on the currently displayed web page. The script, intends to upload an image binary data (not the img src) to a web server, in the same domain as the bookmarklet, for further processing.

this is a bit of code:

$("#img").load(function(data){
    alert(this.src);
})

what I get is the img src => http:// ... I don't know what is in the variable "data". What I need is to convert "this" object to binary, eventually to base64 encoded string I can place in a textarea object, then submit a form to the surver.

I can I convert the object to binary data, please?

4
  • If its on the same server why do you need to upload it, its on the server already, if its on a different server you might run into same origin policy issues. Commented Nov 22, 2012 at 19:07
  • why would you even want to try to convert in browser? Let server convert it from url. Server languages already have libraries to handle this Commented Nov 22, 2012 at 19:37
  • Images are on a web page outside my web site domain. The host does not allow remote file download. So I need to push data to my php script. Well. I made another test with canvas, succeeding with images in the same domain as the web page and my jquery script inside the page (for test). But it fails with an external image. Commented Nov 22, 2012 at 21:53
  • You may want to look at my answer over here. It uses jQuery and base64 encoding. Commented Feb 18, 2013 at 21:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.