# Random Image Showcase

**URL:** <https://forum.getkirby.com/t/random-image-showcase/7282>\
**Category:** Questions\
**Tags:** v2\
**Created:** [April 20, 2017, 3:09pm UTC](https://forum.getkirby.com/t/random-image-showcase/7282 "2017-04-20T15:09:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayeums](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@jayeums](https://forum.getkirby.com/u/jayeums)\
**Post date:** [April 20, 2017, 3:09pm UTC](https://forum.getkirby.com/t/random-image-showcase/7282/1 "2017-04-20T15:09:40Z")

</div>

Hey all,

I have been scouring around the forums to a solution… basically, Im using the random image find:

```
  $showcase = $pages->find('projects','journal')->children()->visible()->shuffle()->first();
  $showcaseimage = $showcase->images()->shuffle()->first();

```

But now my problem is the fact that I want to make a timed slideshow that refreshes the div without refreshing the page. I have tried .load but I have yet to have a solution…

I think maybe ajax is a solution but the other part of the problem is that with the “shuffle()” I cant find a way to not shuffle again to the same image?

Please help!

Thanks,

James.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [April 20, 2017, 3:12pm UTC](https://forum.getkirby.com/t/random-image-showcase/7282/2 "2017-04-20T15:12:35Z")

</div>

Yes, AJAX is the way to go here. If you don’t want to use the same image again, you can exclude the random image from the rest of the images collection using `not()`.

---

<div class="post-metadata">

**Author:** ![jayeums](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@jayeums](https://forum.getkirby.com/u/jayeums)\
**Post date:** [April 20, 2017, 3:15pm UTC](https://forum.getkirby.com/t/random-image-showcase/7282/3 "2017-04-20T15:15:31Z")

</div>

> [@texnixe](#):
>
> e rest of the images collection using not().

how would I achieve this? :S

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [April 20, 2017, 3:25pm UTC](https://forum.getkirby.com/t/random-image-showcase/7282/4 "2017-04-20T15:25:03Z")

</div>

You could pass the filename to your javascript via a data attribute and then pass it to the PHP script as parameter of a GET request or as a POST request.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 4:50pm UTC](https://forum.getkirby.com/t/random-image-showcase/7282/5 "2025-02-06T16:50:08Z")

</div>


