Image From URL

Hello I am generation a list of image urls from a json file. The problem I have is displaying them. 

local json = require('json') local url = 'https://itunes.apple.com/us/rss/topsongs/limit=5/json' local function networkSuccess( event ) data = json.decode(event.response) for key,value in pairs(data.feed.entry) do --print(key,value.label) for k,v in pairs(value['im:image']) do --print(k,v.label) end end end network.request( url, 'GET', networkSuccess )

the images are being loaded from an api and I do not want to save them to a directory, just use them for the moment to display. How to i go about doing this.

I’m assuming that the json contains image URLs so maybe this is what you are looking for:

https://docs.coronalabs.com/api/library/display/loadRemoteImage.html

Best regards,

Tomas

Note: Tomas is right, you can use loadRemoteImage(), just be aware the file gets stored on your device regardless.

It isn’t possible to display an image without having it stored on the device somewhere.  All browsers work the same way (locally store images till they aren’t needed.)

PS - I’m unclear on which baseDir loadRemoteImage() defaults to, but I’m assuming document, so if you need these images to be auto-removed at a later date, be sure to use the temporary baseDir.

I’m assuming that the json contains image URLs so maybe this is what you are looking for:

https://docs.coronalabs.com/api/library/display/loadRemoteImage.html

Best regards,

Tomas

Note: Tomas is right, you can use loadRemoteImage(), just be aware the file gets stored on your device regardless.

It isn’t possible to display an image without having it stored on the device somewhere.  All browsers work the same way (locally store images till they aren’t needed.)

PS - I’m unclear on which baseDir loadRemoteImage() defaults to, but I’m assuming document, so if you need these images to be auto-removed at a later date, be sure to use the temporary baseDir.