Please help me fix my load text over image function, it works but - CORS problem

Hey guys,

Have a JS Fiddle over at https://jsfiddle.net/motion2082/sm1364xt/

I would like to implement this into OpenCart.

When I try to swap the image out with another image it no longer loads.

Also the Canvas DIV is empty when I move it over to OpenCart.

Is there a better way to write this script as I feel like Im doing it wrong?

Regards,
motion

I’m missing something here.

I dont understand what you’re referring to here. How do I recreate your ‘error’?

hi m_hutley,

When I change the src image in

<img style="display:none" src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTsEbEB4kEMHt3WJ13HpZE16hJ3iKrE8ugnErvyln7oNPDma48U" crossorigin="anonymous"/>

the image no longer displays

https://jsfiddle.net/sm1364xt/19/ works fine for me… though setting display:none in the style isnt going to help much…

Try changing the src image to another image and it will disappear.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
    <img src="http://www.yourwebsite.com.au/image.jpg" crossorigin="anonymous"/>
 <input type="text" id="inp"/>
  <button type="submit">Save</button>
</form>

<canvas id="canvas" />

is not a valid image. In my version of the fiddle i linked, i’ve changed it to a picture of a shark. Cause it was the first thing that came up in google for random image.

shark.

Does it have to be linked to a google image?

I tried http://dev.fridayschild.com.au/images.jpg and it didn’t work

Your problem is not a Javascript error, it’s an HTML Your-Image-Request-Was-Denied-by-the-server error. Probably something to do with the anonymous tag. I’m tagging this thread for moving to the HTML section, because i’m not very verbose on CORS, and someone there can probably explain it better than me.

Thanks mate :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.