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?

skyrail
  • 139
  • 1
  • 7
  • 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. – Musa Nov 22 '12 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 – charlietfl Nov 22 '12 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. – skyrail Nov 22 '12 at 21:53
  • You may want to look at [my answer over here](http://stackoverflow.com/q/14726729/483113). It uses jQuery and base64 encoding. – sjngm Feb 18 '13 at 21:56

0 Answers0