Extending the power of WebFM
I've recently been doing some interesting work with the WebFM module.
WebFM is an AJAX file browser that can be used to manage files via the administration interface of your Drupal powered site. The file browser allows you to upload files, create and rename folders, rename existing files and - almost most importantly - allows you to re-organize your files. All these features are available via a drag and drop and 'right click' context menu interface. And of course, WebFM gives you the ability to attach any file to any number of Drupal nodes. And as an added bonus, if you move or rename a file, none of your attachments will break.
I was originally involved in the development of WebFM, but its really been Rob Milne that had done the majority of work on this great tool. Recently however, I've jumped back into its development as I've had to extend the functionality of WebFM to do a few more interesting things. As a result a few new developer features are available in WebFM that weren't there before. One is the ability for developers to add their own 'right click' context menus and define their own AJAX handlers for them. This is made possible by a new WebFM hook: extend_js.
With this hook at my disposal, I've been able to create a module that is a basic image manipulator (yet to be released - still in Alpha). Lets say there are some images sitting inside of WebFM. Lets say you want to show some thumbnails of those images, but only the large original files are inside the file browser. With my new module all you have to do is 'right click' on an image file and select the option to 'create thumbnail.' Voila. Instant thumbnail images at your disposal.
But, that's only the tip of the iceberg when it comes to the ways you might manipulate files. How about creating flashvideo files out of .mpegs with a simple right-click. You can't do that yet, but it wouldn't be that hard to get something like that working.
Another feature that I recently added to WebFM (this is actually released), is integration with the Views module. Now any files that have been attached to nodes via WebFM can be incorporated into a content view. This has a ton of practical implications for administrators and rapid site developers. Want to show a block of the 5 most recently attached files? How about a listing of the 10 largest .pdf's attached to nodes? How about a listing of all images attached to nodes larger than 1M with the 'foo' in the filename? All possible.
The most recent thing that I have been developing is a WebFM CCK field type module. The module allows administrators to create content types that have a field that is either a link to a file or displays an image file. But isn't there already a CCK field type for images? Isn't there already one for files? Well yes, but neither of them have a widget that uses WebFM as a file picker.
This feature is actually developed in two modules. The first is the CCK field type module. The second is a WebFM popup window / file picker module. The CCK field widget creates a link that when clicked pops up a window with a WebFM file browser inside. Inside that window, a user may right click on a file and 'pick' it and by doing so send the value back to the CCK field. The CCK formatters then handle how to display that file (whether its a link or an image tag). This module is also in Alpha, but almost ready for prime time. Expect a release shortly.
So there are a lot of powerful things that you can do with WebFM. The main problem is that there is very little documentation. I would love to get a few spare days to write up some tutorials so that other people can join in the development fun. There are a lot of things that could be done to improve or extend the functionality currently offered. But, I'll save those thoughts for another post.