How to call image in pop up - rest api

how-to
composer

#1

HI,

I display images thumbnail using REST API. Now i need to call its large image in pop up when i click on thumbnail. So can you please let me know how can do it.

Thank You


#2

Hi @raythorsky,

Well it depends on the API you are using.

Could you please tell us which API your are trying to display data from ?

Thanks

Alban


#3

Hi @alban

Thanks for your reply!!!

I am using simple API which connect data base, fetch data and display it in json format like below,

{
“items”:
[
{“id”:“1”,“name”:“Celebration”,“thumbnail_image”:“http://site.com/wp-content/uploads/2017/07/zfp9.jpg",“large_image”:"http://site.com/wp-content/uploads/2017/07/floor-plan-pop-up-new_1.jpg”},
{“id”:“2”,“name”:“Enrichment”,“thumbnail_image”:“http://site.com/wp-content/uploads/2017/07/floor-1.jpg",“large_image”:"http://site.com/wp-content/uploads/2017/07/floor-plan-pop-up-new11_1.jpg”}
]
}

So i display thumbnail images in asset grid. Now i want to show pop up(large_image from json ) image when i click on thumbnail.

Thank You


#4

Hi @raythorsky,

you can use the same solution as mentionned in this discussion : Image based on selected image from Asset Grid

You can add an Image object to your scene, make it as large as you need and do not bind it to any image. When a user selects an Image from the Asset Grid, trigger a “change image” on the new Image Object with the image that was selected. The large image will change anytime you select an image from the Asset Grid. You can play with the visibility if you do not want the Large image displayed all the time

Here are some snapshots of applying this solution with the result coming from a rest API (I used our Wordpress here).

Hope this helps.

Alban