# If/else query for single image or multiple images

**URL:** <https://forum.getkirby.com/t/if-else-query-for-single-image-or-multiple-images/28853>\
**Category:** Questions\
**Tags:** v3\
**Created:** [June 17, 2023, 10:48pm UTC](https://forum.getkirby.com/t/if-else-query-for-single-image-or-multiple-images/28853 "2023-06-17T22:48:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GB\_DESIGN](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/gb_design/32/14956_2.png) [@GB\_DESIGN](https://forum.getkirby.com/u/GB_DESIGN)\
**Post date:** [June 17, 2023, 10:48pm UTC](https://forum.getkirby.com/t/if-else-query-for-single-image-or-multiple-images/28853/1 "2023-06-17T22:48:20Z")

</div>

I am looking for the procedure for an if/else query for the following task:

If an article page has 1 image uploaded, it should be displayed in the header.  
If more than one image is uploaded, a slider should be displayed in the header instead.

With an if/else submission I have to include two different HTML blocks.  
This is not a problem, I already have these blocks.

So far, I’ve gone the manual route, but it’s error-prone and requires intervention when the image count changes:

```auto
<?php if($page->singleimageorslider() == "true"): ?>
<div> …

```

My question: How do I create a `count()` query in the template for the number of uploaded images?

---

<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:** [June 17, 2023, 11:07pm UTC](https://forum.getkirby.com/t/if-else-query-for-single-image-or-multiple-images/28853/2 "2023-06-17T23:07:42Z")

</div>

If it’s just about all/any image uploaded to the page:

```php
if ($page->images()->count() > 1):

```

---

<div class="post-metadata">

**Author:** ![GB\_DESIGN](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/gb_design/32/14956_2.png) [@GB\_DESIGN](https://forum.getkirby.com/u/GB_DESIGN)\
**Post date:** [June 18, 2023, 6:40am UTC](https://forum.getkirby.com/t/if-else-query-for-single-image-or-multiple-images/28853/3 "2023-06-18T06:40:14Z")

</div>

Thank you very much for the quick support.  
I added a query in the template with 3 options where the user can choose: show profile picture only, show photo gallery, show no picture. It works perfectly, thanks to your help.
