# Reading and displaying images dynamically in stadium

**URL:** <https://community.stadium.software/community/t/reading-and-displaying-images-dynamically-in-stadium/165>\
**Category:** How To\
**Created:** [June 20, 2022, 10:47am UTC](https://community.stadium.software/community/t/reading-and-displaying-images-dynamically-in-stadium/165 "2022-06-20T10:47:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shamima](https://community.stadium.software/community/user_avatar/community.stadium.software/shamima/32/268_2.png) [@shamima](https://community.stadium.software/community/u/shamima)\
**Post date:** [June 20, 2022, 10:47am UTC](https://community.stadium.software/community/t/reading-and-displaying-images-dynamically-in-stadium/165/1 "2022-06-20T10:47:12Z")

</div>

Images can be selected from many different sources, including from Connectors (Databases, File systems and Web Services), Static Data or the Stadium Gallery.

In this tutorial, we are going to learn how to set images dynamically inside repeaters using data read from a JSON file.

**Prerequisites:**  
Download, extract the pictures and save attached json file in the **same folder**.  
[pictures.zip](https://community.stadium.software/community/uploads/short-url/phw4e5E1Q3eWAK3Cw6kOHcjuzMH.zip) (86.3 KB)  
[menu.json](https://community.stadium.software/community/uploads/short-url/44LnAClcYWUZ6bW7YYsUxNG1cR0.json) (1.4 KB)

**Description**

- We’ll add a repeater with image control in the StartPage.
- We’ll read our data from a JSON File and store the data in a **list** in the StartPage.Load. We’ll then pass the list data to the Repeater.ItemLoad page
- We’ll use the FileSystem\_ReadFile action to read each image dynamically so that we can display images.

* * *

**Steps:**  
Create a new application.

##### In the StartPage canvas

1. Drag a **repeater** into the canvas.
2. Add an **image** inside the repeater.

##### Now, let’s create a type with the attached json file.

1. Select type, right-click and **import type**. Select the attached json file. Click on create.

* * *

##### We’ll create a file **system connector** that will allow us to populate images inside our repeater.

1. Select **connector, New File System Connector**.
2. Select the folder where you`ve saved the pictures and the json file and click on Save.

 ![image](https://community.stadium.software/community/uploads/default/original/1X/c4925eccc04041f0b7a0bd72107d4a151644f859.png)

* * *

##### In the **StartPage.Load canvas** , let’s read our data from the JSON File and store the data in a **list**

1. Inside the **StartPage.Load** canvas, drag the **FileRead** action from the FileSystem connector created in **step above**. Set the filename as menu.json

2. Drag and drop a list below the FileRead action and set its properties as in the picture  

3. Drag and drop SetValue action with properties below.  

Now, we are done with reading the JSON Data

 ![image](https://community.stadium.software/community/uploads/default/original/1X/49499d820eb304bc6679ea42c24f4e980aec9cc8.png)

* * *

##### The last step is to use the FileSystem\_ReadFile action to read each image dynamically so that we can display images

1. Go to StartPage canvas. Select the repeater. In the **repeater properties** , set the repeater`s **Listitem type** as **Types.type**  

2. Click on the link Create EventHandler in the repeater properties  

3. Inside the **Repeater.ItemLoad** canvas, drag the **FileRead** action from the FileSystem connector created in **step 5 above**. Set the filename as in picture

 ![image](https://community.stadium.software/community/uploads/default/original/1X/7dd553c36f1ad23c1c64bdab89683a86eab1867c.png)

1. Drag and drop SetValue action and set its properties

 ![image](https://community.stadium.software/community/uploads/default/original/1X/589b8e29e93dcca4ef5865c2d88c845770f3b57c.png)

The Repeater.ItemLoad has 2 actions.

 ![image](https://community.stadium.software/community/uploads/default/original/1X/06cde7b59ad1549a2dc1a5b8bdd675f692a55675.png)

* * *

**Preview your application.**  
Congratulations! You should be seeing the following images.

 ![image](https://community.stadium.software/community/uploads/default/original/1X/5c69d6871272d3b92e8705ce767d4689cb3baafa.jpeg)

**Sample**  
[DynamicImageDisplay.sapz](https://community.stadium.software/community/uploads/short-url/h7raxLVQbWmASkmmlJRJxUW52vw.sapz) (8.9 KB)

* * *

**Challenge yourself**

- If you want to save the pictures and JSON file in different folders, you will need 2 different FileSystem connectors.
- You can add other controls in the repeater to display name and id as created in the type

---

<div class="post-metadata">

**Author:** ![shamima](https://community.stadium.software/community/user_avatar/community.stadium.software/shamima/32/268_2.png) [@shamima](https://community.stadium.software/community/u/shamima)\
**Post date:** [June 21, 2022, 6:00am UTC](https://community.stadium.software/community/t/reading-and-displaying-images-dynamically-in-stadium/165/2 "2022-06-21T06:00:32Z")

</div>

Listed on June 21, 2022, 6:00am UTC


