Hello, I have a question for resizing an image.The tutorial to fit images to a size is great to work on display.newImage(), but I cannot manage to do it for display.loadRemoteImage(). I think it because display.loadRemoteImage() does not return DisplayObject which is required for this resize function.
How can I resize a remote image like below?
In my case, I am using an image URL which is a result of API call (network.request). I store it as “image.png”. So far, I can display loadedimage, but I would like to resize it with the parameters I see in the tutorial (ie icon.x = 50 icon.y = 300, fitImage( icon, 200, 200, true)) Thank you very much for your help in advance!
local json = require( "json" ) local function networkListener( event ) local res = json.prettify( event.response ) local decoded = json.decode( res ) if ( event.isError ) then print( "--Network error-- ", ( res ) ) else print( "Results: " .. ( res ) ) --Here a JSON value (URL) is fetched from an API call and use it as a remote image local edmPreview = decoded.items[lot20].edmPreview[1] -- Display image from web local function networkListener1image( event ) if ( event.isError ) then print ( "Network error - download failed" ) else event.target.alpha = 0 transition.to( event.target, { alpha = 1.0 } ) end print ( "event.response.fullPath: ", event.response.fullPath ) print ( "event.response.filename: ", event.response.filename ) print ( "event.response.baseDirectory: ", event.response.baseDirectory ) end local loadedimage = display.loadRemoteImage(edmPreview, "GET", networkListener1image, "image1.png", system.TemporaryDirectory, 200, display.contentCenterY ) end end network.request("https://www.europeana.eu/api/v2/search.json?wskey="..apikey.europeana.."&query=art&qf=when:1900&start="..lotmax.."&reusability=open&media=true", "GET", networkListener, params)