6

I'm sure this can't be difficult, but it has me stumped.

In my view, I want to exclude nodes that do not have an image in a specific field. The field allows an unlimited number of images. I don't care about the exact quantity, just that there are more than 0.

How do I create this filter and what do I filter on?

4 Answers 4

5

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

3
  • The only options I have for my image field are Content: Images (field_images) - delta And Content: Images (field_images) - list. I don't have the filter you are describing.
    – Icode4food
    Apr 22, 2011 at 15:24
  • @Icode4food yes, sorry, choose Content: Images (field_images) - list
    – Laxman13
    Apr 22, 2011 at 15:30
  • 1
    Note that this no longer works for Views 3.x. Also this might produce duplicate results. See this answer for better results Mar 8, 2015 at 18:15
7

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.

1
  • 1
    This is the correct answer for Views 3.x Mar 8, 2015 at 18:13
2

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

1

I tried the Laxman13 instruction, but that process didn't worked to me. I think that the listing value is related to a node display context.

In my case, I had to create a relationship with my CCK image field (Content: Image - fid) and then make a file ID filter (File: File ID) using the previous relation with a "not empty" validation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.