# Default Image block fallback

**URL:** https://forums.losant.com/t/default-image-block-fallback/5329
**Category:** Help
**Tags:** dashboard, image
**Created:** [November 14, 2023, 11:36pm UTC](https://forums.losant.com/t/default-image-block-fallback/5329 "2023-11-14T23:36:34Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Nick\_Calibey](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/nick_calibey/32/4628_2.png) [@Nick\_Calibey](https://forums.losant.com/u/Nick_Calibey)
#### Post date: [November 14, 2023, 11:36pm UTC](https://forums.losant.com/t/default-image-block-fallback/5329/1 "2023-11-14T23:36:35Z")

</div>

Hi there,

I was wondering if there was a way to render a fallback image for a dashboard. Basically, my use case is that I’d like to display an image of the sensor provided by the customer. If no image exists, then I’d display a “No Image Available” image (as opposed to a block render error).

One idea I had was to add a tag to the devices that specified the path to the image. I could then set this `imagePath` to the fallback image if none other existed. However, I don’t think I can use a context variable to pass this down as the user would have to pass the path in – ideally I just want to use the value of this tag depending on the image selected. Any thoughts? Thanks!

---

<div class="post-metadata">

### Author: ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)
#### Post date: [November 14, 2023, 11:57pm UTC](https://forums.losant.com/t/default-image-block-fallback/5329/2 "2023-11-14T23:57:05Z")

</div>

I think what you are looking for is the [`{{defaultTo}}` helper](https://docs.losant.com/workflows/accessing-payload-data/#defaultto-val-default).

If you are storing the URLs on a device tag called “imageUrl”, you could reference that value through a device context variable (called “deviceId” in this example):

```hb
{{ctx.deviceId.tags.imageUrl}}

```

Then, fall back to a default image of your choice if that value is not set:

```hb
{{defaultTo ctx.deviceId.tags.imageUrl 'https://placekitten.com/640/640'}}

```
