I am having a sample application which is having networking images, how to display preloaded cache images when navigating between pages. Because it is taking some time for loading from api calls. instead of placeholder how to display same image which loaded previously.
I am trying to use flutter_cache_manager 0.1.1, cached_network_image 0.4.1+1
plugins but still unable to achieve.
I think you are looking for FadeInImage where you can set a placeholder image until the actual image becomes available.
The actual image can come from various ImageProviders like NetworkImageWithRetry or similar.
In my application is like (Montage) to show a lot of images, videos , music and also to mainatain the image id for its own identification and other purpose. I need to know the whether the all image is show using sdwebimage in imageview or after i logged in all images to download and saved it to local files ? Tell me which is good ?
SDWebImage is already providing caching mechanism, so instead of downloading all images at once use SDWebImage
SDWebImage also using lazy load, so the performance of your application will be good.
But if you try to download all images at once, it will degrade your app performance. You need to wait before loading view till downloading end.
Hey just wondering if its possible to Select a specific image from the photolibrary and implement into a Collection View
so the idea is to have an image the user can select from the photolibrary then fill the selected image into a cell within the collection view i would also like to be able to save the image so if the user deletes the photo from the library it remains within the application ( was thinking i could save the image within firebase or NSUserdefaults?
A controller demonstrating how to select photos to display in a collection view can be found here.
If you're only going to be saving a single image, then putting it at a known path like demonstrated here would work: How to save a remote image with Swift?
If you're trying to manage multiple images, it's probably a good idea to look into Core Data and have it manage the images' UIImageJPEGRepresentation NSData for you. (Be sure to set "Store in External Record File" for the image data record if you do this!)
Hi i am pretty new to IOS so pardon for silly questions . I am working on an app which loads large images in a tableview. Images to be loaded are of large size (>5MB) so i am trying to resize the image into thumbnails ,cache it and the load it asynchronously to table view. i found many ways and discussions for doing the same for network images (SDWebImages etc.) but i couldn't get anything for doing the same with local images (camera/photo library). Can any one tell me how to implement it?
You need to implement lazy loading of image along with asynchronous loading of images.
https://developer.apple.com/library/ios/samplecode/LazyTableImages/Introduction/Intro.html
https://github.com/rs/SDWebImage
http://iphonedevelopment.blogspot.in/2010/05/downloading-images-for-table-without.html
Imagine you use a web service that delivers images via an API. Every image has an UID and you have a Core Data entity Image with attributes uid (int) and image (transformable).
Now a gallery of your app needs to show many images (the UIDs are known). You don't know which of the images have been downloaded and stored before. How can you lazily download images with core data in the background, so that the view may show an UIActivityIndicator during loading and automatically shows the image as soon as it is stored locally (e.g. by using the NSFetchedResultsControllerDelegate protocol)?
Is it useful to subclass UIImageView for that purpose?
Yes, you can use Core Data for this, but be forewarned that there is a performance hit when you use Core Data to store images. It's negligible if you're dealing with small (e.g. thumbnail) images, but for very large images, the performance hit is observable. For large images, I'd store the images in Documents folder (or, better, a subfolder), and use Core Data to keep track of what images have been downloaded, their filenames, etc. But if the images are smaller, keeping everything right there in Core Data is cleaner.
I probably would not want to use a subclassed UIImageView for this purpose, because you might want to decouple the presentation layer (the image view) from the caching of images. Also, for sophisticated user interfaces, UIImageView objects may be discarded or reused as the user scrolls through a big collection of images, so you might not want a hard link between the UIImageView and your caching logic. Also, depending upon your user interface, sometimes the images can dictate something broader than the UIImageView (e.g., if you're using a tableview, you might want to adjust the cell height based upon the image as it's downloaded). The particulars of the implementation of what the UI might do depend upon where the image is being used (a UITableView, a UIScrollView that is showing a grid of images, etc.).
So, bottom line, for simple user interfaces, perhaps you could subclass a UIImageView but I'd generally advise to have some custom image caching object that does the lazy loading with some delegate protocol to tell the UI when the image load is complete.
I wouldn't use Core Data to store images, but I'd store them on disk. I was trying to find in the documentation where Apple themselves warn against storing images larger than 100k or so in Core Data since you'd run into a performance issue.
However, I found this article that talks about Core Data Image Caching that may be of use.
Also, here's another Stack Overflow post with a good answer that tells you when to store images in a database and when to just use references to disk storage.
If you don't absolutely need Core Data, then may I recommend using MWPhotoBrowser?
https://github.com/mwaterfall/MWPhotoBrowser
It essential generates a gallery view controller for you which you can push onto your navigation controller. The gallery view controller has scrollable images with pinch zoom, pan, everything, even emailing the photo to someone.
It also does the lazy loading of the image with the activity indicator.
Short answer: everything you wanted to do without reinventing the wheel.