Drupal: An image module that uses filemanager module
I’m working on a personal project using Drupal. The image module allows you to let users post images to the site. However, it puts all of its files into a single directory, which is a performance concern if you want to have a lot of images on your site. The filemanager module has support for lots of files, but the image module was not written to use it.
So I decided to try my hand at Drupal coding. I started with image.module and overhauled it to work with filemanager.module. Along the way I found that Drupal 4.7 doesn’t offer a good way to maintain certain data through the form preview, so I filed a bug. The workaround I came up with, and also used by a prominent Drupal coder, was to use the $SESSION variable to maintain that data.
So anyway, here is the new image.module code. Please feel free to try it and let me know what I should fix.
Some notes: the current version 0.1, requires you to use only the original, preview, and thumbnail sizes, and also requires a database table called imagefm. I also could not come up with an elegant way to handle the case of a single user posting multiple images at the same time, sicne the $_SESSION variable used only allows for one per user at a time. This may be easy to fix, but I don’t fully understand the Drupal form API yet.