Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I just spent a day with a partner working through this with CamanJS. </p> <p>Without knowing how you're constructing your view (and not knowing Pixastic at all) I'll do my best to answer. </p> <p>Assuming you're linking to the original image in your html, add <code>crossorigin='anonymous'</code> into the image tag: </p> <p><code>&lt;img class='image' crossorigin='anonymous' data-camanheight='450' src=&lt;%= @photo.url%&gt;&gt;</code></p> <p>This will set up the browser's expectation that the image will not come from your site's url. </p> <p>We found this to work for the initial image, but when CamanJS' revert() function reconstructs the image (before converting it back to a canvas element), it leaves out the header information that lets the browser know that it's ok that it is cross-origin data. So every time we reverted an image, we hit a CORS issue again. I looked through Pixastic's docs briefly, but can not advise you on whether or not you'll have a similar issue.</p> <p>NOTE: A super fluid experience was our priority, and we didn't want to set up a proxy, so our work-around was to keep a clone of the image tag on hand in a Javascript variable and write our own method to revert the canvas, re-cloning the the image tag, pushing one of the cloned tags into the DOM and then converting it to a new canvas element and getting rid of the old one. It ran into some CamanJS specific behaviors that made it a little 'hacky.'</p> <p>My partner on the project has submitted a pull request to CamanJS that retains the header info, so this may be resolved soon, making CamanJS a better solution for cross origin resource sharing. </p> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload