# Accepting multiple image formats

**URL:** <https://forum.getkirby.com/t/accepting-multiple-image-formats/3100>\
**Category:** Questions\
**Tags:** v2\
**Created:** [January 21, 2016, 2:24pm UTC](https://forum.getkirby.com/t/accepting-multiple-image-formats/3100 "2016-01-21T14:24:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ernst](https://avatars.discourse-cdn.com/v4/letter/e/9f8e36/32.png) [@ernst](https://forum.getkirby.com/u/ernst)\
**Post date:** [January 21, 2016, 2:24pm UTC](https://forum.getkirby.com/t/accepting-multiple-image-formats/3100/1 "2016-01-21T14:24:07Z")

</div>

Hello again!

We’ve setup a content folder where all blog posts are organised by folder. Currently, our code accepts ‘header.png’ as the header of a blog post. So far so good.

We would like to add jpg/jpeg/gif as an option as well. It just looks for either one of those extensions. And we will manage that there is only 1 image file at a time.

Anyone with experience in this area? ty!!!

```auto
      <div class="blog-image" style="background-color: <?php echo $page->Colour() ?>;">
        <?php if($image = $page->image('header.png')): ?>
          <img src="<?php echo $image->url() ?>" />
        <?php endif ?>
      </div>
    </div>

```

---

<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:** [January 21, 2016, 2:43pm UTC](https://forum.getkirby.com/t/accepting-multiple-image-formats/3100/2 "2016-01-21T14:43:27Z")

</div>

Try

```php
$image = $page->images()->filterBy('name', 'header')->first();

```

If there is really no other image, you can also use:

```php
$image = $page->file();

```

which will return the first file in the folder, [https://getkirby.com/docs/cheatsheet/page/file](https://getkirby.com/docs/cheatsheet/page/file)

---

<div class="post-metadata">

**Author:** ![ernst](https://avatars.discourse-cdn.com/v4/letter/e/9f8e36/32.png) [@ernst](https://forum.getkirby.com/u/ernst)\
**Post date:** [January 21, 2016, 4:09pm UTC](https://forum.getkirby.com/t/accepting-multiple-image-formats/3100/3 "2016-01-21T16:09:29Z")

</div>

Thank you - resolved.

---

<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, 5:00pm UTC](https://forum.getkirby.com/t/accepting-multiple-image-formats/3100/4 "2025-02-06T17:00:22Z")

</div>


