We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Processing Progra to react to MySQL Database input
Page Index Toggle Pages: 1
Processing Progra to react to MySQL Database input (Read 615 times)
Processing Progra to react to MySQL Database input
Apr 12th, 2010, 5:54pm
 
I'm a beginner trying to create a program that will run every time something is added to a database.

Specifically-I am creating a site that is based around obscure knowledge of its members. I want members to use processing to upload a photo, which remains pixelated until a certain amount of data is entered into a database about the member.

Does anyone have any ideas about how to have a program react to data input?

Also does anyone have any ideas about to pixelate a photo incrementally in processing?
Re: Processing Progra to react to MySQL Database input
Reply #1 - Apr 12th, 2010, 7:00pm
 
You'll want to break your task down into a few steps, which you have already started to do. There are two major components to what you are attempting, one of which must be done on the server. Processing is a great tool for image manipulation, but it doesn't easily export to server-side scripts.

To get started on the pixelation, I would first look at the pixels[] array:
http://processing.org/reference/pixels.html
Loop through the pixels, and at each step, draw a rectangle with the color of the current pixel. For example, you could skip every other pixel, and draw a 2x2 rectangle at each step. This might be the first thing you want to get working, and is definitely the one Processing is most suited to.

For uploading images, you'll need to use a server-side script; processing applets run on the client-side. Look for php, python, or ruby code that handles image uploading. Something like http://codeigniter.com/ or http://www.sinatrarb.com/ might make that process easier.

To run the program each time an entry is put into your database, you'll need to have your script that updates the database know about your processing app and run it (and have permissions to run the app on your server). It might be simpler to have your processing applet run whenever someone visits the page, and have it get fresh data from your database each time.

Page Index Toggle Pages: 1