• CTCObras
  • 0 Points
  • Member since 2011

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1

Hey everyone,

I have a problem that probably has a lot of differnet answers so if you think you have a better approach feel free to let me know.


I am working on a visualforce page that has an HTML5 canvas element. The canvas loads an image from a publically available document. I need to get the base64 value of this image after the user has modified it. The problem is, because this is hosted on a force.com site, the domain is different than the the one that hosts the image. You cannot use canvas.toDataURL('image/jpeg') on a canvas that has content loaded via drawImage().


So the fix I see, like when you have to make a cross domain ajax request is to create a server side proxy. In this case, my proxy needs to act as an image server. I need the visualforce page to get the image requested (as a url argument) and display it, as if it was just an image, not a web page. Alternativly if i could get the base64 encoded value of the image and print that on the page, that would be fine as well.


Well feel free to leave any feedback as I am bit stuck for now. Thank you!