I'm trying to port the functionality of an image gallery I had made previously (based largley on phpMyPhotos), into a drupal module.

I'd be generating nodes on-the-fly (is this a good idea?) during browsing image files/dirs on the filesystem abolishing a need to upload.

What I'm stuck on is whether to create actual drupal nodes (so that people can add comments to folders, images), or to fill in a separate table for all but the topmost node. I am halfway implementing the second method, and am starting to realise that comments are useful (and fun!) and that I'd either have to re-implement commenting for my own nodes or 'hack' the current comment system probably breaking my upgrade path.

Anyone have any opinions/suggestions?

In particular: is there a good reason NOT to create drupal nodes on-the-fly, and will creating these roughly 25000 nodes (potentially one per directory/image viewed) have a big performance hit? That's the main reason I would have liked to create the "real" node only WHEN a comment was added, but that doesn't seem possible.

Thanks!

Comments

andrew404’s picture

I don't believe you should have a problem doing the auto-generate for nodes. Have a look at module node_import, which will import nodes from a csv file, similar activity to yours.

At the end of the day, I'm pretty much a newbie though, so take anything I say as a grain of salt

degerrit’s picture

Thanks for your feedback, and pointer.

Though a big difference between node_import and my module is that in my gallery module node-generation would be initiated by the user (without knowing it), and not the administrator. The user needn't even necessarily be a registered user. So security may be a bigger issue, performance definitely.

Also imagine a bug with nested links of directories and then a search engine hitting the site - your database would be on its knees in no time generating (completely unforseen and useless) nodes. In the worst case you could fill the hard disk, run out of node ids or other unforseen problems.

That's why I would definitely prefer it if a node would only be generated if there is a "need" for one: because someone wants to post a comment, for example (a latent node, if you will). Of course, even in my 2nd scenario 'accidental' nodes could still be generated.