0

I am trying to get Views to display files I have uploaded to my server using the Media module.

My end-goal is to display the 5 most recently uploaded pictures (from any album) in a slideshow on the front page (using Views Slideshow).

My website as a whole will be my personal photography-website when it's complete. The way I have everything set up so far is: I created a new content type for my pictures called Photos. Next, I create a new piece of that custom content and upload pictures to it. The organization structure is that, each new piece of Photos content behaves like an album--containing a set of images pertaining to it's title.

For example, if I wanted an album specifically dedicated to landscapes, I would create a new Photos piece of content, and upload all my images of landscapes to it.

The problem I have right now is, I can get Views to display my custom content type and scroll through it, but because each individual picture is wrapped inside a Photos content, the View will display every single image in that album 'per-slide'. How do I get Views to only display the five most recently uploaded Media files? (As opposed to what it's doing right now, displaying the five most recently added Photos albums.)

(Using Drupal 7)

7
  • Are you using Media 1.x or File Entity/Media 2.x?
    – tsvenson
    Jan 31, 2013 at 16:41
  • I'm using Media 7x-1.2 as the 2.x version isn't stable yet.
    – Matt
    Jan 31, 2013 at 16:44
  • Had a hunch you where on 1.x. Just wanted to make sure. Yes, 2.x doesn't have a stable 2.0 yet, but the code is actually in good shape. Thing is that 2.x has a much improved Views support that I believe your needs would benefit from a lot. From what I understand, your site is not launched yet. If so, giving 2.x a quick test if it works might prove fruitful for you.
    – tsvenson
    Jan 31, 2013 at 16:50
  • I honestly cannot get the Media 2.x module correctly installed. I disabled the old Media module, and installed File_Entity and Media 2.x. Now different parts of the site such as the content page is throwing up all kinds of errors.
    – Matt
    Jan 31, 2013 at 19:04
  • Ahh, sorry. Should have been more clear about performing those test on a separate installation. Upgrade from 1.x to 2.x isn't 100% there yet.
    – tsvenson
    Feb 1, 2013 at 9:48

2 Answers 2

0

In your field in your view, if you uncheck the option "Display all values in the same row" in the "Multiple field settings", each new image in any photo piece of content will be considered as a row. You then will be able to show only the last 5 images instead of the last 5 photo albums.

1
  • Your solution worked thank you! But after upgrading to Media 2.x it contained new methods that allowed me to directly display a file as a field in a View without using any workarounds!
    – Matt
    Feb 2, 2013 at 3:39
0

Gregory has given you a good option.

Another option would be to use field collection instead of simple image field this way if you want you can add additional information to each image.

And when you create a view of the type field collection you can select the image field and also sort it using the Field collection item: Revision_id that way you would be able to show the last fields. Or you can sort with Field collection item: Field collection item ID

2
  • Your addition to Gregory's suggestion worked great, just many steps. I would upvote your response as highly helpful if I was at level 15.
    – Matt
    Feb 2, 2013 at 3:39
  • good to know that it helped....... :-) Feb 2, 2013 at 5:38

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.