Fork me on GitHub
#quil
<
2019-04-23
>
lspector20:04:36

For @pez, demonstrating the "tainted by cross-origin data" problem with loading an image.

pez21:04:28

I’ll have a look, @lspector. But I’m far from an expert on these things so don’t expect much. 😃

lspector21:04:58

Thanks @pez. The issue is that we just can't load any image at all. We definitely used to be able to. I just downloaded a fresh version of https://github.com/PEZ/quil-cljs-calva-template, added (q/load-image "prog9.png") to setup, added the image to resources/public, ran lein cljsbuild once, opened index.html, and I get the same error. So it's not anything else about the student's project from which I produced the file attached above.

Eric Ervin23:04:21

hmmmm... I see the image here. Once I made it into a functioning quil project in core.cljs, (also shrinking that ginormous image to 211k), "lein compile", and opened index.html, it looks fine. Let me see if I can post my core.cljs ....

(ns drawing-project.core
  (:require [quil.core :as q :include-macros true]
            [quil.middleware :as m]))

;;(enable-console-print!)

(defn setup []
  {:img (q/load-image "prog9.png")})

(defn update-state [state]
  state)

(defn draw-state [state]
  (q/background 200)
  (q/image (:img state) 0 0))

(defn run-sketch []
  (q/defsketch drawing-project
    :host "drawing-project"
    :size [500 500]
    :setup setup
    :update update-state
    :draw draw-state
    :middleware [m/fun-mode]))