I've tried messing around with the image.module function image_get_random in order to get it to display more than one thumnail, but I've been unsucessful. Can anyone tell me how I can do that?

Comments

zahor’s picture

And how do you display the title of the thumnails?(mine will be products, so I'd like to have the name of each one displayed)

sillygwailo’s picture

Ah, the Views module to the rescue again. Here's how you would create a sitebar block (it should work similarly for a page view as well):

  1. Name: this will be the block name under Administer » Site building » Blocks.
  2. Under the "Block" heading, check "Provide block".
  3. For "View type", select "Table view" if you want the title to be beside the image, "List view" if you want it above or below the image.
  4. The "Title" is what will appear as the title of the block to users.
  5. Type in the number 5 for the amount of nodes to appear in the block. The random part comes later.
  6. Under the "Fields" heading, add the "Node: Title" field and the "Image: Display Image" field.
  7. Under the "Filters" heading, add a "Node: Type" filter, then select "Image" as the node type.
  8. Optional: add a "Taxonomy: Term for Image Galleries", where you can select from which gallery it will select the images.
  9. Under "Sort criteria", add the "Random" criteria. I don't think it matters if it's ascending or descending.

In my limited testing, it seems to take unique random nodes, but if not, under the "Filters" heading, add a "Node: Distinct" filter.

(Username formerly my full name, Richard Eriksson.)

zahor’s picture

For some reason, I had trouble following the above instructions in IE 7, whenever I tried to add a field, or filter or argument, it kept saying none were defined and didnt provide me with the drop down menu to add them. I used another computer with IE 6 and it worked just fine.

But it works great, and is just what I was looking for.
Thanks for the help Richard!

JohnnyMoney’s picture

Unfortunately Drupal 6.x Views version doesn't show the "Image: Display Image" field in the Fields selection. Is there another way to do this in Drupal 6.x?

Correction: I think it's the IMAGE module of version 6.x that doesn't provide the image field to be chosen in views yet.