There is an content type called "imagenode". This content type contains title, body and one image field (unlimited images can be uploaded/attached).

Now exactly one node from imagenode is created: 20 Images are attached/uploaded.

Question: How can I create a views block that displays one random image out of these images attached to this one node from type imagenode?

I can create a view with fields and show one image and I can set an offset in order to display onother image. But there seems to be no way to display one random from all attached images.

How can this be solved in Drupal 8?

1 Answer 1


1) Click on your image field

  • Under Multiple Fields Settings, uncheck display all values in the same row.

2) Add Global: Random as your sort and remove the default sort (content post date).

enter image description here

  • Thank you! I have found this solution by myself before you answered.
    – drupalfan
    Commented May 31, 2016 at 8:12
  • @drupalfan great, you should still accept the solution by clicking on the ✅ checkmark, thx.
    – No Sssweat
    Commented May 31, 2016 at 8:45
  • okay. sorry, I am new here.
    – drupalfan
    Commented May 31, 2016 at 8:46
  • @drupalfan no worries :)
    – No Sssweat
    Commented May 31, 2016 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.