Purusothaman Ramanujam
I am getting lot of "Status Code:400 Bad Request" messages in the console due to this plugin. Is that expected?
Image caching directive using imagecache.js library.
Ionic directive to cache images or element background images on first load.
This library works with Ionic Framework (v >= 1.0), the supported platforms being:
Install
Bower
bower install --save ionic-img-cache
npm
npm install --save ionic-img-cache
Add imgcache.js and ionic-img-cache.min.js files to your app index.html file.
cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-file-transfer
angular.module('app', [
'ionic',
'ionicImgCache'
])
<access origin="*"/>
<access origin="cdvfile://*"/>
<allow-intent href="cdvfile://*"/>
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<preference name="iosPersistentFileLocation" value="Library"/>
Just add ion-img-cache
attribute to img
tag you want to cache.
Example:
Image:
<img ion-img-cache ng-src="{{ imagePath }}"/>
Background image:
<div ion-img-cache-bg>Element with abckground image set with css or ng-style</div>
ionImgCacheSrv.clearCache()
- returns promise, so you can chain it with .then
and/or .catch
.
Unfortunaly there is no way to invalidate single image now.
Caching can be configured via ionicImgCacheProvider
, there are available parameters in this provider:
Type: Boolean
Default value: false
Enables ImgCache debug mode.
Type: Number
Default value: 50
Quota for storage size available for cached images in MB.
Type: String
Default value: ion-img-cache
Set name of cached files directory.
Example:
angular.module('app')
.config(function($ionicImgCacheProvider) {
// Enable imgCache debugging.
$ionicImgCacheProvider.debug(true);
// Set storage size quota to 100 MB.
$ionicImgCacheProvider.quota(100);
});
Hey there! You'll need to log in before you can leave a comment here.
I am getting lot of "Status Code:400 Bad Request" messages in the console due to this plugin. Is that expected?
No, it worked good in my projects, may be you can provide an example or some code to see what was going wrong?
hi..Thanks for the directive, haven't tried it yet, but do you have a github link?
Yes, just click on purchase externally button
Hey, can you tel us where is the location of the cache. How can we delete it. And in general how we can verify if the cache is working.
It stores cache in the file system, details here https://github.com/chrisben/imgcache.js/. I can add more wrappers for ImgCache methods (clearCache for example) if needed. To check thet image cached just see img element markup)
Great! Bookmarked!
Hi Thanks , Working fine , But clear caching is not working
Could you create issue on github https://github.com/vitaliy-bobrov/ionic-img-cache I'll try to fix it.
Great plugin. How we clear the image cache
Sorry for a late reply, I've just added this feature to the new release :) If you have any other ideas/improvements feel free to create an issue on GitHub. Thank you.
It is not working on iOS10 https://github.com/vitaliy-bobrov/ionic-img-cache/issues/4
Hi, I dont see imgcache.js in your repository. Can you help? Thanks
Hi, I dont see imgcache.js in your repository. Can you help? Thanks
It is not working on iOS10 https://github.com/vitaliy-bobrov/ionic-img-cache/issues/4
Great plugin. How we clear the image cache
Sorry for a late reply, I've just added this feature to the new release :) If you have any other ideas/improvements feel free to create an issue on GitHub. Thank you.
Hi Thanks , Working fine , But clear caching is not working
Could you create issue on github https://github.com/vitaliy-bobrov/ionic-img-cache I'll try to fix it.
Great! Bookmarked!
No, it worked good in my projects, may be you can provide an example or some code to see what was going wrong?
Hey, can you tel us where is the location of the cache. How can we delete it. And in general how we can verify if the cache is working.
Yes, just click on purchase externally button
hi..Thanks for the directive, haven't tried it yet, but do you have a github link?
I am getting lot of "Status Code:400 Bad Request" messages in the console due to this plugin. Is that expected?
It stores cache in the file system, details here https://github.com/chrisben/imgcache.js/. I can add more wrappers for ImgCache methods (clearCache for example) if needed. To check thet image cached just see img element markup)
Hey there! You'll need to log in before you can leave a rating here.
Nice)
it works :)
{{ rating.comment }}
{{ rating.comment }}
it works :)
Nice)