# Access image meta data in KirbyText tags?

**URL:** <https://forum.getkirby.com/t/access-image-meta-data-in-kirbytext-tags/12698>\
**Category:** Questions\
**Tags:** v3\
**Created:** [February 5, 2019, 4:37am UTC](https://forum.getkirby.com/t/access-image-meta-data-in-kirbytext-tags/12698 "2019-02-05T04:37:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![blakewatson](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/blakewatson/32/295_2.png) [@blakewatson](https://forum.getkirby.com/u/blakewatson)\
**Post date:** [February 5, 2019, 4:37am UTC](https://forum.getkirby.com/t/access-image-meta-data-in-kirbytext-tags/12698/1 "2019-02-05T04:37:40Z")

</div>

I realize I can write:

```
(image: foo.jpg alt: foobar)

```

But I’m making use of the fantastic file blueprints feature to add an alt text field. Is it possible for me to access that data in a tag? Otherwise, it seems like having an alt text field is only useful in template code.

My use case is that I’m grabbing the first image of a page and using it in a list template as a cover image—so I need access to alt text in template code. But on the page itself, I need alt text in the main WSYSIWYG field. Currently, the only solution I can think of is to duplicate the alt text—once in the KirbyText tag and once in the image meta data.

Is there another way?

---

<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:** [February 5, 2019, 8:45am UTC](https://forum.getkirby.com/t/access-image-meta-data-in-kirbytext-tags/12698/2 "2019-02-05T08:45:04Z")

</div>

Guess what? You don’t have to do anything: Kirby picks up the content of an `alt` field defined in your meta data automatically unless you overwrite it in your tag.

```auto
$tag->alt = $tag->alt ?? $tag->file->alt()->or(' ')->value();

```

---

<div class="post-metadata">

**Author:** ![lule](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@lule](https://forum.getkirby.com/u/lule)\
**Post date:** [May 15, 2019, 5:08pm UTC](https://forum.getkirby.com/t/access-image-meta-data-in-kirbytext-tags/12698/3 "2019-05-15T17:08:24Z")

</div>

What other content of the meta data does kirby pick up automatically?

---

<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:** [May 15, 2019, 5:18pm UTC](https://forum.getkirby.com/t/access-image-meta-data-in-kirbytext-tags/12698/4 "2019-05-15T17:18:34Z")

</div>

`alt`, `title` and `caption`:

```auto
$tag->alt = $tag->alt ?? $tag->file->alt()->or(' ')->value();
$tag->title = $tag->title ?? $tag->file->title()->value();
$tag->caption = $tag->caption ?? $tag->file->caption()->value();

```
