3

After manipulating an image using a canvas element and then getting the result via canvasImg.toDataURL( "image/jpeg", 1.0 ), is it possible to convert the result into a binary image file client-side? I am trying to avoid

  1. a round trip to the server and
  2. Sucking the server's RAM into a GD process.

The goal is to edit the image and get it onto s3 as a file without touching my server.

axlotl
  • 1,412
  • 1
  • 13
  • 20
  • 1
    does this help: http://stackoverflow.com/questions/13990673/upload-canvas-data-to-s3 ? – Daniel C Sep 18 '15 at 23:12
  • Yes, it totally does. Well, once I found this too: `URL.createObjectURL().` Thank you. Wish I could accept this as an answer because the title of that q doesn't match my search terms but it solves this problem. – axlotl Sep 19 '15 at 00:23
  • Ah sure we're not here for the points – Daniel C Sep 19 '15 at 00:38
  • Sure. Other people just might be searching with my string. Which does contain the problem but with different words. – axlotl Sep 19 '15 at 00:49

1 Answers1

1

Daniel C's comment led me to the solution (here at Convert Data URI to File then append to FormData).

The one extra thing I needed was URL.createObjectURL(blob), which gave me a string handle to pass the file around.

Community
  • 1
  • 1
axlotl
  • 1,412
  • 1
  • 13
  • 20