Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • I tried this and it almost works! But I can get the image to go into my id the image is put at the bottom of the body. When i do document.getElementById("blah").appendChild(img); nothing happens at all.. Commented Feb 18, 2014 at 0:38
  • @BluGeni Try document.getElementById("blah").src = img; instead of document.body.appendChild(img); Commented Feb 18, 2014 at 1:04
  • I get [object%20HTMLCanvasElement] 404 (Not Found) with that Commented Feb 18, 2014 at 1:13
  • Ok, i just reread the doc for this feature. It seems to return a canvas while using the option orientation. So this should work: document.getElementById("blah").src = img.toDataURL();. I'm sorry that i cannot test it out myself. Commented Feb 18, 2014 at 1:21
  • @morgul after reorienting the image, how can I replace it in the input field so that the changed image gets submitted in the form? Commented May 28, 2019 at 11:03