imgcache.js icon indicating copy to clipboard operation
imgcache.js copied to clipboard

Preloaded images not being recognised

Open michaeljcoyne opened this issue 8 years ago • 0 comments

In my app component (Ionic) I initialize imagecache. I then loop through the images on a remote server to preload them. I can see them being downloaded into the imagecache folder.

I then use the following code:

ImgCache.isCached(that.src, (path: string, success: boolean) => {

          if (success) {
              alert('caching ' + that.src);
              ImgCache.useCachedFile(that.img, function () {
                  alert('now using local copy ' + that.src);
              }, function () {
                  alert('could not load from cache' + that.src);
              })

          } else {
              alert('no cache ' + that.src)
              ImgCache.useOnlineFile(that.img);
              ImgCache.cacheFile(that.src, () => {});
          }

      });

This doesn't work the first time. It is not recognizing the previously downloaded file. Why is this? Is it naming them differently or something? Is there a way to force the reference?

michaeljcoyne avatar Apr 04 '17 10:04 michaeljcoyne