One Hour Image Transitions

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!

AttachmentSize
header_images.zip13.16 KB

Cool

Nice to have a feature. I usually just create a view and stick jQuery.cycle somewhere. The lightweight version is usually good enough for all my needs and there's nothing extra to install besides CCK image field and views. Perhaps I'll take your lead and create a feature for doing this with jquery.cycle.

Thanks Jonathan. jQuery.cycle

Thanks Jonathan. jQuery.cycle is great as well, although I really like the navigation and linking features of Nivo. If you go with jQuery.cycle, you might want to check out the lite version, http://jquery.malsup.com/cycle/lite.

Great feature!

It's great to see an example of a feature in use. I've been meaning to put some of my repeat work into features but never get around to it. I also learned about the nivo slider. Awesome!

Is the feature downloadable?

(am i missing the link somehow?)

download available

Just updated the post with a download. Thanks for the interest.