Advised by Merlin to open up a ticket here regarding this issue. The issue is that in certain situations views will not show some (I believe the first 10 but I have not tested that fully) of the images attached to nodes. Steps to duplicate:

Fresh install of Drupal 6.19 with:

Views 6.x-2.11
Content 6.x-2.8
Filefield 6.x-3.7
Imagefield 6.x-3.7
ImageAPI 6.x-1.9
ImageCache 6.x-2.0-beta10

To duplicate:

  • Create a content type (slideshow)
  • Create an CCK image field (image). Leave the default settings.
  • Create 10 pages of the content type you created with one picture attached to each one.
  • Add another CCK image field to the content type (image2).
  • Create at least three more pages with an image attached to the second image field (leave the first blank).
  • Create a view.
  • In the fields select the second image field to display.
  • Select none for the label and Image for the format. {The issue persists regardless of the format}
  • You will get no results or fewer results then expected depending on how many pages you made with an image attached to the second CCK image field.

    If you run the SQL query views gives it returns the correct number of results.

    This came up while troubleshooting a views slideshow issue with Pyista42 on IRC. Pyista42 worked around the issue by going back and adding the images to the second CCK image field on the pages where he previously only had images on the first CCK image field.

  • Comments

    quicksketch’s picture

    Category: bug » support

    You will get no results or fewer results then expected depending on how many pages you made with an image attached to the second CCK image field.

    I don't think you get fewer results, it's just that there is not image to actual display if one has not been uploaded, so you get an empty row. The end result is probably something like 3 rows that have images and 10 rows that don't have anything at all (so it looks like only 3 results were returned). You need to to filter your view results so that only nodes that contain images are included in the results. You can do this by adding a relationship for "Content: Image" and then checking the box to only include items that use this relationship. See these related issues: #480508: Create a "has file" filter/sort (then expose it to the user) and #372241: Make a "has file" Views Filter

    Durrok’s picture

    Ah... that actually makes a lot of sense. Thanks quick.

    Durrok’s picture

    Status: Active » Fixed

    Status: Fixed » Closed (fixed)
    Issue tags: -views

    Automatically closed -- issue fixed for 2 weeks with no activity.