I have a multiple value field (imagefield) which allows users to add as many images as they like to nodes (4 different content types share the same field).

I have a view that takes arg User ID to show all the images uploaded by the user - this is on their Profile (we use a Panels override).

The problem is that each image appears multiple times - some twice, others three times. I cant use node distinct since that will only return one image from the node, whereas each node can have many images (multiple value cck field).

I have tried using Group Multiple Value fields but this has not solved the issue.

Any pointers greatly appreciated.


devenderdagar’s picture

Try to do some php code in templating and there you can restrict only one image.

Jeff Burnz’s picture

I am wondering how that can be done, the query is already built well before it gets to the template, unless there is some param I can use to restrict the output from within the template (panel pane tpl).

devenderdagar’s picture

There are so many options in views. When you template a view, you can access all the parameters of the views. Like it is first record and then it is second one and so on. You can set one php condition that if record counter is one then display otherwise dont display.

I hope you can see it now


Jeff Burnz’s picture

Not really, I posted here because I need specific information, you answer while well meaning is very generic and not really telling me what I need to know - I realize this can be done, the question is one of specifically how.

apmsooner’s picture

Might be worthwhile to know what you are trying to accomplish with the image as assigned to multiple nodes. If you are simply building photo galleries where the same image appears in multiple galleries, I might suggest setting up the gallery content type as an organic group and photo as group post posted to multiple groups (galleries). That way you could filter down by group post with distinct option checked and perhaps accomplishes what you need. Again, I'm guessing your intent but maybe thats an option that works for you.

Jeff Burnz’s picture

Images are not assigned to multiple nodes, but rather there are multiple images on a single node (CCK MVF).

What we are doing is showing all images uploaded by a user on their user profile page, a sort of user-gallery block of all their images (that they have added to news, blog posts, articles etc).

So it works like this:

  1. User creates a node (eg a news post) and adds some images to it. The news item appears in the as per usual with images etc.
  2. In the users profile page each iamge appears as a thumb in their gallery block (a Views generated block, we use Panels/CTools for context).

Its in the users block that we have the problem, for some reason the images are often repeated (for no logical reason that I can see). The extra oddity is that this ONLY happens for Anon site viewers, if you log in they display as per normal (no repeated thumbs).

WorldFallz’s picture

Can you post the export of the view?

Care about the future of the Drupal.org forums? Please join our conversation and show support for improving the forums infrastructure.

Jeff Burnz’s picture


Uses panels and semantic views.

Hmmm, I'm looking at it now and the prob seems to have evaporated... must talk to the site builder if he made any changes...

alberto56’s picture

I have a similar question so I'm posting it here. Maybe a solution for one will be a solution for the other. I will try to be as specific as possible.

Post Nodes can be assigned to organic group Nodes.
For example,
Post A is assigned to group 1, 2 and 5.
Post B is assigned to group 1, 3 and 5.
Post C is assigned to group 1, 2 and 3.
In the context of group 1, I want to create a list of all other groups which have a post which is also in group 1.
So, in this example, I want my list to contain 1, 2, 3, 5.

My filter is nodes of type "Post", and I am displaying the group fields for each post. So I am getting 1, 2, 5, 1, 3, 5, 1, 2, 3.

Is there any way of achieving a list 1, 2, 3, 5 using views?


apmsooner’s picture

Did you try marking the distinct option within the view you have setup? The option is in views for drupal 6... not sure about previous versions.

alberto56’s picture

Thanks, yes. It doesn't work for me; here's why, I think: the distinct option refers to the nodes (in my case posts) which are selected, so that the same post won't be selected twice. However, the group fields within the posts are not distinct between nodes, so that group 1 relating to post A is considered distinct from group 1 relating to post B. So it still appears several times.

apmsooner’s picture

Maybe you could add argument for node title posted as a summary sorted ascending. So the view should show each post with instances (each group it occurs) in parentheses like this:
post 1 (5)
post 2 (7)
post 3 (1)
post 4 (2)
From there you could theme it to your requirements I imagine. I don't know if this would be the optimal way of doing it but only thing I can think of to narrow down to not show duplicates.

alberto56’s picture

Thanks for the suggestion. I tried to do it this way, but to sort, I needed to use relationships (a rather hard-to-grasp concept, see video here if you're not familiar with it: http://drewish.com/node/127). Then, I ran into a problem where relationships only work with the first value (for example, if a node has several groups, only the first group is listed). I'll keep trying... thanks again.

travib’s picture