I'm planning to make a node that will allow a user to choose some settings from a few different form elements, press submit, and based on those settings, the node will generate an image with some text using the PHP image functions. (A small preview first would be even better, with the final version being saved with the node.)

I thought of using CCK for the form handling because if it works, I'm going to want to add more settings (more form elements) and so I thought that would be the easiest way to go.

I think I can get everything I want out of CCK. I was thinking of using the "calculated field" module to do the image wrangling, returning the name of the file to the field as a value. I'm not sure if this will work. Can I attach a big chunk of PHP to a CCK package outside a calculated field? Am I trying to cram too much into a CCK node? Should I just be building a module from the ground up instead?

(For those who think "just go try it", my computer died and I'm waiting for parts. In the short term, I thought I'd ask for advice.)

Any thoughts?

Comments

ronan’s picture

This maybe breaking the code/theme barrier, but you could create the images at the theme level. That would be somewhere between calculated field and full module. I am always leary about storing php in the database (which I assume calculated field does, though I've never used it), maybe it's a strange bias but something about it gives me the heebie-jeebies.

You would have to deal with caching the images and invalidating the cache when a node is edited, so it might be enough code to justify a module.

Any of these solutions will work to varying degree of convenience. It's really more of a philosophical question of where you are comfortable sticking your php code.

R
------------------------------------
Gorton Studios - Websites that Work. http://www.gortonstudios.com/
http://www.gortonstudios.com/portfolio/technologies/drupal

------------------------------------
Ronan
Founder - NodeSquirrel - https://www.nodesquirrel.com/
Agency Tools Lead - Pantheon - https://www.pantheon.io/