# Builder Field: no preview with image and sizes

**URL:** <https://forum.getkirby.com/t/builder-field-no-preview-with-image-and-sizes/17208>\
**Category:** Questions\
**Tags:** v3\
**Created:** [February 10, 2020, 5:19pm UTC](https://forum.getkirby.com/t/builder-field-no-preview-with-image-and-sizes/17208 "2020-02-10T17:19:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![coko](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@coko](https://forum.getkirby.com/u/coko)\
**Post date:** [February 10, 2020, 5:19pm UTC](https://forum.getkirby.com/t/builder-field-no-preview-with-image-and-sizes/17208/1 "2020-02-10T17:19:03Z")

</div>

I’ve got a Builder Field image block which uses srcset and sizes. The preview for this block can’t be generated with the `sizes` present when I remove the sizes the preview shows as aspected. (Obviously, I can make a snippet for preview only.) When using a textarea and a Kirby image tag with the srcset and sizes it does work.

No preview with `sizes`:

 ![no-preview](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/8/8566f7037e22c5e1e7173e9adaa1a699a49c9023.jpeg)

Preview without `sizes`:

 ![preview](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/6/6f8def913b6941bcb08c6270ad6f2ab0a3a0d3f1.jpeg)

---

<div class="post-metadata">

**Author:** ![timoetting](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/timoetting/32/781_2.png) [@timoetting](https://forum.getkirby.com/u/timoetting)\
**Post date:** [February 10, 2020, 9:37pm UTC](https://forum.getkirby.com/t/builder-field-no-preview-with-image-and-sizes/17208/2 "2020-02-10T21:37:24Z")

</div>

Hey @coko,

Can you tell me if there are any javascript errors in the console?

---

<div class="post-metadata">

**Author:** ![coko](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@coko](https://forum.getkirby.com/u/coko)\
**Post date:** [February 12, 2020, 4:55pm UTC](https://forum.getkirby.com/t/builder-field-no-preview-with-image-and-sizes/17208/3 "2020-02-12T16:55:16Z")

</div>

Tim, sorry for the late reply, busy …  
Yes, errors, a quick screenshot:

 ![errors](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/8/87b31d2d49d86812627fa5959350eb0fbea63804.png)

---

<div class="post-metadata">

**Author:** ![timoetting](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/timoetting/32/781_2.png) [@timoetting](https://forum.getkirby.com/u/timoetting)\
**Post date:** [February 12, 2020, 5:01pm UTC](https://forum.getkirby.com/t/builder-field-no-preview-with-image-and-sizes/17208/4 "2020-02-12T17:01:43Z")

</div>

As a workaround, would it work when you replace every `$kirby` with `kirby()` inside `site/snippets/blocks/images.php` ?

The $kirby variable is not available during preview. It is a valid point that this variable should be available here aswell.

---

<div class="post-metadata">

**Author:** ![coko](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@coko](https://forum.getkirby.com/u/coko)\
**Post date:** [February 12, 2020, 5:06pm UTC](https://forum.getkirby.com/t/builder-field-no-preview-with-image-and-sizes/17208/5 "2020-02-12T17:06:17Z")

</div>

Yes, I’ve got those sizes from my config: `sizes="<?= $kirby->option('srcset-sizes.default') ?>"`.  
So I can call them with `kirby()` also? Well, that’s no probs.

---

<div class="post-metadata">

**Author:** ![timoetting](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/timoetting/32/781_2.png) [@timoetting](https://forum.getkirby.com/u/timoetting)\
**Post date:** [February 12, 2020, 5:09pm UTC](https://forum.getkirby.com/t/builder-field-no-preview-with-image-and-sizes/17208/6 "2020-02-12T17:09:53Z")

</div>

Yes. In Kirby context you can almost always call kirby() and page() if $kirby and/or $page are, why ever, not available.

---

<div class="post-metadata">

**Author:** ![coko](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@coko](https://forum.getkirby.com/u/coko)\
**Post date:** [February 12, 2020, 5:10pm UTC](https://forum.getkirby.com/t/builder-field-no-preview-with-image-and-sizes/17208/7 "2020-02-12T17:10:29Z")

</div>

Ok, thanks.
