So I set up an image gallery using this basic method:

http://jamestombs.co.uk/2009-05-12/create-an-album-based-image-gallery-i...

In short - a content type "album" is created, having a filefield image field with an unlimited count. Photo albums are created by creating a new node of type "album", and then new images are added to that album by adding a new file attachment to the node with filefield.

A views 2 view formats each "album" node into a gallery page.

That's all fine and dandy, however I'd like to have a "latest images" block that can display a flickr-style grid of perhaps 10 of the latest images (same concept as the "latest image" block with the image module). This would involve a query that would search all of the "album" nodes and their filefields for the most recently added photos.

Does that make sense? Can this be done with views2, or do I need a custom query? I'm assuming I'll need something customized, but I'm just now beginning to harness the power of views2 so I just wanted to make sure there wasn't anything I was missing.

Thanks in advance to anyone who can help!

Comments

VM’s picture

it can be done with views.

create a block display
set up your fields
use the table or grid display

save the new view

go to adminsiter -> blocks and enable the new block created when you saved the view.

hawkeye217’s picture

Problem with that is the view will only display the nodes in grid view (which are "albums", not individual filefield images).

Each "album" node has multiple images attached, so the “items to display” setting in views affects the number of _albums_ to display, not the number of images in those albums.

Setting “Show (x) values” of course only displays x number of photos from those albums, which could give me the most recent photos from the “items to display” number of albums.

I need to stay on the node level somewhere because I want to display a certain number of the latest images from all of the album nodes.

friolator’s picture

it sounds like "Group multiple values" might be checked in the field attributes for the images in Views. try unchecking that and see if that helps. We had to do something similar to avoid similar behavior with Views Carousel.

hawkeye217’s picture

That "sort of" works - but the problem remains - the "latest" images are now displayed, along with the rest of the images from that "album". So if I add a new image to album A and a new one to album B, all of the images from album A are displayed along with all of the images of album B. I just want the new images displayed.

Is there an ID number or something kept with a filefield that I could use to identify the "latest" from each album, based on a unique, increasing number?

Then I could write a query that could look through each of the "album" nodes and find x number of the "latest" photos, since there is no date field or anything associated with filefield that I know of...

hawkeye217’s picture

Figured it out.

I didn't notice you can order by "File ID", which is exactly the way I needed them ordered to show the "latest" image first (because fid is serially increasing).

I LOVE views 2!