Processing JS, HTML and PHP issue

I’ve made a processing sketch that I had upload on my website (localhost). But the buttons that I programmed doesn’t work because i’m using the “selectInput” function that is not avaible in web. So, I guess I need to make that button in HTML, but i don’t know how to connect it with the processing sketch (I insert the sketch with echo script type etc.)

I have a second question, how do I connect that processing sketch with a data base? I need to save the last picture that a guy upload so the next guy that enters to the web can see it.

Thanks for reading!

1 Like

Have you considered using p5.js rather than processing.js? It has p5.DOM and the third party p5.blizzard, which might enable you to work with html elements of all kinds.

https://p5js.org/examples/dom-modifying-the-dom.html

I believe that you can also mix p5.js with other javascript more easily than Processing.JS – although I’m not a Processing.JS expert.

If we use Pjs as a JS library, we can use any vanilla JS libraries on it as well. :partying_face:

For example, this is a Pjs sketch written in CoffeeScript transpiled to JS: :coffee:

And now that same Pjs sketch written in Processing’s Java Mode: :coffee:

But if we end up converting a Java Mode sketch to use the JS syntax (or another JS transpilable language), there’s little reason to target the old Pjs instead of the current p5js library though. :roll_eyes:

1 Like