npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

ionic3-image-cache

v0.1.4

Published

A Simple Ionic Image Cache for all types of images with preview modal

Readme

ionic3-Image-Cache

A rewrite of Ionic Image Loader library that fixes the SVG issues, local URL detection and base64 detection yet maintaining all other major features. This Ionic plugin also includes features such as image preview. Hats of to @riron for Image viewer

Ionic Module that loads images in a background thread and caches them for later use. Uses FileTransfer from cordova-plugin-filetransfer, and cordova-plugin-file via ionic-native wrappers. This module helps to save Http requests to the server all the time thereby saving bandwidth and other HTTP related issues.

Gif

Features

  • Downloads images via a native thread. Images will download faster and they will not use the Webview's resources.
  • Preview images on click or tap - (can be disabled)
  • Caches images for later use. Remote URLs are counter matched with the file system file and returned.
  • Shows a loading spinner while the images are loading. (can be disabled and customised with other spinner names in ionic)
  • Allows setting a fallback image to be displayed in case the image you're trying to show doesn't exist on the web. (optional)
  • Works with the WKWebView Engine (iOS), as the images are copied to the temporary directory, which is accessible form within the WebView

Installation

1. Install the NPM Package

npm install --save ionic3-image-cache

2. Install Required Plugins and Dependency

npm i --save @ionic-native/file
ionic cordova plugin add cordova-plugin-file
npm install --save @ionic-native/file-transfer
ionic cordova plugin add cordova-plugin-file-transfer
npm install --save ionic-img-viewer

3. Import IonicImageCacheModule module

Add IonicImageCacheModule.forRoot() in your app's root module

import {IonicImageCacheModule} from 'ionic3-image-cache';

// import the module
@NgModule({
  ...
  imports: [
    IonicImageCacheModule.forRoot()
  ]
})
export class AppModule {}

Usage

Basic Usage

This HTML code demonstrates basic usage of this module:

<ionic-image-cache [src]="this.sender.profile_image.url"></ionic-image-cache>

<ionic-image-cache [isAvatar]="'true'" [showPreview]="'false'" (tap)="whatever($event)" [src]="this.sender.profile_image.url" class="img-circle"></ionic-image-cache>

You can also listen to the load event to be notified when the image has been loaded:

<ionic-image-cache [src]="this.sender.profile_image.url" (loaded)="onImageLoad($event)"></ionic-image-cache>

...

onImageLoad(data) { // do something with the loader }


## HTML attributes
The `<ionic-image-cache>` component takes many attributes that allows you to customize the image. You can use the following table as a reference:

| Attribute Name | Type | Description | Default Value | | --- | --- | --- | --- | | src | string | The image URL | N/A | | isAvatar | boolean | Sets an avatar image as a placeholder rather than image placeholder | false | | showPreview | boolean | Displays a full screen version of the image with gestures. | true | | imgCssClass | string | You can inject css classes to the image | N/A | | highResSrc | string | Set a highres image to use for image preview on click when showPreview is set to true | Original Src | | fallbackUrl | string | Sets a custom placeholder image Url while awaiting cache load | N/A | | spinnerName | string | Set a spinner name from the list of ionic spinners list | dots | | spinnerColor | string | Set a spinner color from your variable set at variables.scss e.g primary | Default | | alt | string | Sets an alternative text when image fails on browser | N/A | | enableSpinner | boolean | Enable or disable spinner | true |

Note: Upcoming features. Please contribute your features.

  • Typescript options from controller
  • Clear cache
  • Max cache settings
  • Cache lifespan

Contribution

  • Having an issue? or looking for support? Open an issue and we will get you the help you need.
  • Got a new feature or a bug fix? Fork the repo, make your changes, and submit a pull request.

Support this project

If you find this project useful, please star the repo to let people know that it's reliable. Also, share it with friends and colleagues that might find this useful as well. Thank you :smile: