image resize for remote images ?

Hi Abdul, 

I am happy to hear you got this one working. I am a little confused though. I suggested the same and you mentioned its still crashing. Was there anything else you needed to fix to get fitImage( event.target, 50, 50, false ) to work?

Thanks for sharing your solution. Regards,

Kerem

Just an FYI for anyone else reading this thread. display.loadRemoteImage() does not return a display object, so a variable assigned to it will not be a display object as you might expect.

It will only return the display object in it’s callback function. It states this in the documentation too.

Happy coding :wink:

Ksan,

the issues that I was using variable assigned to display.loadRemoteImage instead of event.target.  As mentioned in docs that you cant use variable with this function. I may not understand you at the beginning.  so

fitImage( event.target, 50, 50, false )  – works fine

fitImage( horse, 50, 50, false )  – does not work

One more point if you have experienced with display.loadRemoteImage … i want to load images into Tableview with many rows. i am worried about the space it used in the device as I noticed it saves them locally under temp folder. Assuming you are having Tableview with 100 rows each with an image, you will end up with 100 images downloaded under temp folder. Still i don’t know how to mange this efficiently and how it should behave when user refreshes the tableview. I know temp folder is mangled by device and it gets deleted when the device needs more memory. So what will happen if the user is viewing the tableview and device delete the temp at the same time ?? will that crash the app ??

 i have this question long back but no answer yet  ?

http://forums.coronalabs.com/topic/48069-does-displayloadremoteimage-always-need-to-be-saved-locally-in-the-device/

I hope someone can share his knowledge ?

Regards

Abdul

Great! Thanks for the clarification. I do have a similar use case in an app and I don’t use display.loadRemoteImage at all. I download the images first and then add them to my tableView. I keep my images in DocDir and don’t delete them but you could easily delete them too when not needed. Maybe this is an option for you to consider. 

Ksan,

how do you download them and at which size ? then how do you place them in the tableview. Let us suppose the images are dynamic such as news … will this works fine ?

thanks

Abdul

I use network.download - http://docs.coronalabs.com/api/library/network/download.html 

the images in my case are pre-sized on my server. I only get thumbnails to be inserted into tableView. 

Simply create a display object in your onRowRender for the image relevant to the row.

thanks ksan for sharing your experience.  I will ask more questions if you don’t mid :slight_smile:

are the thumbnails done manually or dynamically and at what size ? what is the reasonable size you have experienced ?

when user clicks on the thumbnail picture ? what happened? do you have any touch/ tap events behind it to open in a large format or the device itself managed that ?

thanks

Abdul