A very common request I get lately is for a banner containing a series of image transitions, often on the home page. Certainly a fairly simple feature, one I've already solved in different ways, E.g., here, here, and here. So when I had a similar need, I decided to finally build a stable and flexible module I could easily reuse. But as any good Drupal citizen knows, better to see what's already out in the contrib space before recreating the wheel. I also like to scour the landscape for any lateset and greatest libraries before a new project, in this case for JQuery image transitions. I came across Nivo Slider, which quickly led me to the corresponding Drupal module. Combine this with CCK (imagefield), Imagecache, and Views, bundle it into a Feature, and voila, a 1 hour flexible and reusable banner transition tool.
Final recipe is as follows.
- Create a content type with an imagefield and an optional link field. I would default this content type to unpublished since you likely don't want it turning up in search results or elsewhere.
- Define an imagecache preset that will size images for the banner space in mind. All the images need to be the same size for elegant transitions.
- Create a view, e.g., header_images and configure as follows:
- At least filter for the header content type. Make sure to include unpublished content if you're taking the approach suggested above.
- Add fields for the image, an optional title which is used as the image caption, and an optional link.
- Set your view style as Nivo Slider and adjust the global transition settings.
- Set your row style as Nivo Slider and map your image, title, and link fields.
- Add a block display to the view.
- Optionally place the block into a Context.
- Bundle everything into a Feature and deploy. The feature should include the content type, view, imagecache preset, relevant permissions, and optional context.
That's it. You can see this feature in action at the new Portland Design Works site. And next time I need something similar, it will take closer to 15 minutes rather than 60.
UPDATE (9/23/2010): Feature posted for download. I'm still working out the best way to manage my features, aside from running a feature server. Suggestions welcome!