1

On my webpage I have <img src="//example.com/path/image.jpg" id="foo">. In my testing environment I'm executing a userscript and I'd like the userscript to get the image (binary, base64 encoded, it doesn't matter) and POST it to http://localhost:1234/debug/. Later on I may make it more sophisticated and POST the hash but right now I have no idea how to get the image.

I'm not sure if this matters but the image is on my site and I may move it to a static domain.

  • @E.Sundin That looks like a decent solution. However I'm a little worried. Will it convert it to a bitmap/uncompressed and force me to save as a png image? Then I won't have the original file/filesize/hash (base64 hash is acceptable). I probably don't need a video solution but maybe in 2017 (the link is 09) there's a more straightforward solution. I'll need it to test it –  Mar 20 '17 at 22:52
  • 1
    Don't quite know what you want to achieve (so we might be facing an XY problem), but there are a few options you could consider: send the URL rather than the file to the server (and the server could then download it if needed), or load the image using Ajax. Both have different drawbacks. – jcaron Mar 20 '17 at 23:04
  • 1
    The duplicate link is indeed correct in that the **question** is actually a dupe, but the answers there aren't that correct. Passing an image to a canvas will modify this image (see https://en.wikipedia.org/wiki/Canvas_fingerprinting). So I'll post an answer on the dupe target instead of yours. – Kaiido Mar 21 '17 at 00:59

0 Answers0