Last updated 10 June 2011. Created on 25 September 2009.
Edited by batigolix, joachim, John Bickar. Log in to edit this page.

This page contains various tips, tricks, and recipes for doing stuff with the views support in the image package. Please add your own!

Display Only Nodes with Attached Images by Using Relationships

The Image Attach module allows the creator of a View to limit the display to only those nodes which have an image attached to them. In Drupal 5/Views 1, this was accomplished via a filter; in Drupal 6/Views 2, it is done via a Relationship.

  1. In the Views edit screen, click the plus sign next to Relationships to add a new relationship.
  2. Under Defaults: Add relationships, check the box for Image attach: Attached image nodes.
  3. Click add.
  4. Under Defaults: Configure Relationship Image attach: Attached image nodes, check the box for Require this relationship.
  5. Click Update.
  6. Click Save to save your View.

The resulting View will display only nodes that have attached images.

Finding 'orphaned' images

If you use images only with image attach, you may want to 'clean up' image nodes that are no longer attached to a node.
A view of image nodes with the following will show you only image nodes that don't have an attaching node:

- Add the relationship Image attach: Attaching nodes
- Add the filter Node: nid on this relationship, and set the operator to 'is empty'.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.