Ionic product Image loading - ionic-framework

I am developing a shopping app using web API,
But getting issues like whenever app open
It will take to much time to load products.
Maybe from product image will take time to render
, any idea how to resolve this issue

U can improve a performance of your app by doing following steps
Use pagination(i.e load 10 or 15 product from web api) on scroll
Maintain low size images at server so it could load fast.
Show a busy image while the actual image is downloading, and when the image is downloaded, remove busy image and show the actual image.

1 - use ion-infinite-scroll
2 - lazy load the images
3 - use image cache

Related

How to create an application which uses bulk of images from web service

I am newly in iOS development.I have to make an application for a car dealer in which i have to show different cars with different colors.Please tell me the best way because i have to fetch lots of images every time from the web server.How can i reduce the rendering time in fetching the images.
Please consider i am very new in ios development and need your help.
If you have any sample application please share it with me.
You can use DB to store images as BLOB and also fetch images only when there is update at server.
First, make sure you send images that are no larger than needed.
If you have a list view that shows pictures of the cars, have a webservice send you premade thumbnails that are (preferably) exactly the right size.
Second, Make sure the images are loaded separately from the data set.
The best place to do this, would be in the controllers for your UITableViewCell.
Just have your UITableViewCell start their own thread to download and display the image as soon as they come into view.
Third; caching.
Make sure you save local copies of the thumbnails, and make sure the Table View Cells search for local copies of the images, and load those instead of downloading them if they are already locally present.
you can do:-
use lazy loading
use paging
use predicates for searches
use fast enumeration
these things in general will keep your app smooth
If you are going to show images in UITableView then you can use lazy loading. It will load images only for the displayed rows and once image for any row index has been downloaded, it will not repeat downloading for that row index. So its faster and useful.

load and cache remote image in background thread

I am working on an iPhone app.In this app I need to display many images in uitableview.I am able to load the image in the background thread.But can anyone suggest how can I cache the downloaded image in background thread.I am able to cache the image but it is happenening in foreground not in background.Thats why the UI gets blocked until the caching completes.Thanks in advance.
Hi you can try SDWebImage Cache, it is very easy to use and it will do caching part.
The caching interval is set to one week, you can check it in SDImageCache.m.

How to download and load downloads image in Custom UITableViewCell?

I get the text form the sever like this:
test_abc
http://www.xxx.a.jpg
test_aaa
http://www.xxx.b.jpg
test_ccc
I want to split the string to ["test_abc", "http://www.xxx.a.jpg", "test_aaa", "http://www.xxx.b.jpg", "test_ccc"] and then display them in a UITableViewCell,before the images will be downloaded, I used a LoadingIndicator as placeholder, when the images will be downloaded, display the images and modify the height of the cell to display the whole images.
Can someone help me do this?
Try looking into Three20
An open source library written by the guy who wrote the official "Facebook" app for iOS. Moreover, the code of the facebook app is based on that library.
You may use SDWebImage, and you don't have to worry about cache, etc..
Web Image
This library provides a category for UIImageVIew with support for remote images coming from the web.
It provides:
An UIImageView category adding web image and cache management to the Cocoa Touch framework
An asynchronous image downloader
An asynchronous memory + disk image caching with automatic cache expiration handling
A guarantee that the same URL won't be downloaded several times
A guarantee that bogus URLs won't be retried again and again
Performances!

img src with large image size on UIWebView taking time to load and sometimes crashes

I display html string on UIWebview, and html string comes from server.
In html which I retrieved from server, is having 10 images which are large sized with src attribute. those images total size is above 4 MB. when I load this html string into UIWebview, application takes 4 mins to load images sometimes and sometimes it crashes.
I want to know, if there is any solution to <img src..> tag where I can make thumbnail images.
Any response will greatly appreciated.
Thanks
You should be able to find out on the server-side via java/html5 what browser your client is and what features it has. In doing so the server can determine the appropriate image size to send to the client.
My company has successfully implemented this with iPhone and Android client's retrieving images that are smaller in size as opposed to browser's on laptops receiving larger images.
Good luck!
Big chunks of memory allocated can trigger a sigkill 9 from springboard on heavy system load (by protection) even if you don't overlap the 46MB given for any single application running.
The best way to do this would be to load one image at a time.
For each individual image, create a smaller version.
Release the currently big image loaded since you have a smaller version of it.
Do it again for next, and so on.
You will reduce the impact of big loads.
The Nimbus Framework is doing image download and resize that way. Have a look.
For the UIWebview, I'm not sure of what you can do. Since you get the HTML before displaying it, you could perhaps grep the <img> tags and creating those thumbnails, storing them to the iPhone, replacing the src path of the original <img> tags by a local URL of your thumbs.
Probably the device you are using cannot support 4MB images when decompressed in a UIWebView.
Which device are you using?
4 minutes to load 4 images is a very long time. Is your network very bad? Otherwise it could be another indicator of wrong approach.
Being you I'll try to use native UIImageView to display the images and perform some kind of queued download, maybe with ASIHTTP.
So you can load and unload the images when you need them and avid keeping them always in memory.
As Jojas point, I still think that the answer is correct as the UIWevView drains memory to render the DOM elements.

UIWebView: some images not loading

Good day.
I have a UIWebView that loads a big article with 10+ images. HTML code is stored locally, images are loaded by UIWebView automatically.
Sometimes web view won't load all of the images (for example, 3 out of 10). It doesn't depend on a connection type (EDGE/WiFI), image amount (sometimes web view loads 20 out of 20 images, sometimes doesn't load 3 out of 5).
As for now the only way to fix this as I understand is parsing <img> tags in HTML and loading images programmatically to a local cache for future displaying.
Any thoughts? Is there any way to control UIWebView's image loading?
Thank you.
I've recently had the same issue on another project: some images were displaying as half black only on slow connections like GPRS/EDGE. The reason was that my client's web server had a limit for connection time when downloading images. If you've run into similar issue don't forget to check that.