Drupal - Filter to only nodes with an image in an imagefield

If you filter by one of the image field's subfields (e.g. fid, delta, language, width, height, etc), you may end up with duplicate rows in the results, which is usually not desirable. To avoid that, just filter by the "image_field_name:delta" field instead, setting the Operator to "Is equal to" 0. That should filter out all rows without images, and without creating duplicates.


In the edit screen of your view, click "+" symbol in the filters box to add a new filter. Settings for filter:

  • Select your imagefield you want to filter on (ex "Content: My Image (field_my_image) - list") and click the "Add" button
  • Check True and click "Update"

Now only your selected nodes that has an image in the imagefield will show in the view


Often, you will not have a True/False option. In this case, click to add Filter, select an image which ends with :fid. FID is short for File ID. Select "Is not empty (NOT NULL)" from the select menu.

This would require the File ID to be present; and File IDs cannot be present without the file.

enter image description here

Tags:

Media

Views

7