Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dan-leech/com.danleech.cordova.plugin.imagecache
Cordova Android/iOS Image(file) Cache native without permissions and dependencies
https://github.com/dan-leech/com.danleech.cordova.plugin.imagecache
cache cordova-android cordova-ios cordova-plugin dependency-free image-processing native
Last synced: 2 days ago
JSON representation
Cordova Android/iOS Image(file) Cache native without permissions and dependencies
- Host: GitHub
- URL: https://github.com/dan-leech/com.danleech.cordova.plugin.imagecache
- Owner: dan-leech
- License: mit
- Created: 2018-12-21T12:55:18.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-21T13:22:49.000Z (about 6 years ago)
- Last Synced: 2024-10-15T09:25:12.799Z (3 months ago)
- Topics: cache, cordova-android, cordova-ios, cordova-plugin, dependency-free, image-processing, native
- Language: Java
- Size: 9.77 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cordova Image Cache plugin
Native Image Cache plugin for iOS and Android.
This plugin do not require any permissions or dependencies. It uses temporary folders to store binary representation of your images with timestamps. If timestamps are greater it stores a new image version. Plugin has two levels of cache in browser ram and on the device for increase loading speed.
# Install
```
cordova plugin add com.danleech.cordova.plugin.imagecache
```# Usage
#### Simple:
```js
let p = new Promise((resolve, reject) => {
cordova.plugins.ImageCache.get(imageUrl, timestamp, resolve, () => {
cordova.plugins.ImageCache.store(imageUrl, timestamp, imageUrl, resolve, reject);
});
});p.then(url => {
// already loaded image url
let img = new Image();
img.src = url;
})
```
#### Firebase Storage
```js
let p = new Promise((resolve, reject) => {
cordova.plugins.ImageCache.get(imageKey, timestamp, resolve, () => {
firebase.storage().refFromURL(imageKey).getDownloadURL()
.catch(err => {
reject(err);
})
.then(url => {
cordova.plugins.ImageCache.store(imageKey, timestamp, url, resolve, reject);
});
});
});
```# License
Project is available under the MIT license. See the LICENSE file for more info.