P5.js: DOM createImg() not working

Created on 20 Feb 2018  Â·  7Comments  Â·  Source: processing/p5.js

Nature of issue?

  • [x] Found a bug
  • [ ] Existing feature enhancement
  • [ ] New feature request

Most appropriate sub-area of p5.js?

  • [ ] Color
  • [ ] Core
  • [ ] Data
  • [x] Events
  • [ ] Image
  • [ ] IO
  • [ ] Math
  • [ ] Typography
  • [ ] Utilities
  • [ ] WebGL
  • [x] Other - DOM

Which platform were you using when you encountered this?

  • [ ] Mobile/Tablet (touch devices)
  • [X] Desktop/Laptop
  • [ ] Others (specify if possible)

Details about the bug:

  • p5.js version: v0.5.6 January 03, 2017
  • Web browser and version: Chrome 64.0.3282.167
  • Operating System: Mac OSX Yosemite 10.10.5
  • Steps to reproduce this:
p5 sketch (simplified to isolate problem)

// createCanvas() works, createImg() generates error below.

let canvas;
let alien;

function setup() {
canvas = createCanvas(100,100);
alien = createImg('https://upload.wikimedia.org/wikipedia/commons/5/5b/Alien-hack-master.png');
}

error in console:

p5.dom.js:319 Uncaught TypeError: p5._validateParameters is not a function
at p5.createImg (p5.dom.js:319)
at setup (bubbles.js:6)
at p5. (p5.js:9108)
at p5. (p5.js:9038)
at new p5 (p5.js:9320)
at _globalInit (p5.js:5602)

All 7 comments

Hello, sorry to hear about your trouble. I tried it quick with p5 v0.6.0, which is the newest version on the p5 site, and it worked right away for me. (Also I am using the same version of chrome as you)

screenshot 2018-02-19 19 15 25

Can you try using the newest p5 version to see if it works for you?
https://github.com/processing/p5.js/releases/download/0.6.0/p5.zip

Yup - that did it!

Thanks.

On Mon, Feb 19, 2018 at 7:19 PM, Tyler Stefanich notifications@github.com
wrote:

Hello, sorry to hear about your trouble. I tried it quick with p5 v0.6.0,
which is the newest version on the p5 site, and it worked right away for
me. (Also I am using the same version of chrome as you)

[image: screenshot 2018-02-19 19 15 25]
https://user-images.githubusercontent.com/810727/36406134-7c04b2c4-15a9-11e8-8eb0-c0af74e3841b.png

Can you try using the newest p5 version to see if it works for you?
https://github.com/processing/p5.js/releases/download/0.6.0/p5.zip

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/processing/p5.js/issues/2658#issuecomment-366856247,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AaxLAc8XYENpDgfyg8Ey_wGLGbE9Ghsqks5tWjnRgaJpZM4SLXGO
.

Great to hear!

Good luck!

Hi guys, I'm getting error createImg is not defined while using createImg and the latest version of p5. Has this been changed or removed in the current version ?

Hi guys, I'm getting error createImg is not defined while using createImg and the latest version of p5. Has this been changed or removed in the current version ?

looks like now it is called loadImage

How about leaving it for backward compatibility and issuing a warning? There are many tutorials on the web using createImg and it's frustrating trying to diagnose when one is new to P5.

createImg is a function in p5.dom library, make sure you have included that library in your HTML file or you will get a createImg is not defined error.

Was this page helpful?
0 / 5 - 0 ratings