Giter Site home page Giter Site logo

freshvine / jquery-cache-images Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 2.0 2.23 MB

Makes for easy caching of image files in the browsers LocalStorage or indexedDB. Can be bound elements or parents.

Home Page: http://freshvine.github.io/jQuery-cache-images

License: MIT License

JavaScript 64.77% HTML 19.88% CSS 15.36%
browser-localstorage cache image indexeddb javascript jquery jquery-plugin localstorage

jquery-cache-images's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jquery-cache-images's Issues

Adapt drop to target a specific cached url

would be called like.
$.fn.cacheImages.drop('http://my.diamonds/are-awesome.jpg');

New param would prefix existing. Both would be optional and if both are undefined it should wipe everything with the default prefix. The check on the new URI param would check for a length greater then 1, and if that is true it would attempt to only drop that value. Would be helpful on the back-end cleaning up images when they are no longer needed.

$.fn.cacheImages.drop( URI, storagePrefix )

Create function to place images

This would be used interally within the plugin to see if we:

  1. Have a local version of that image
  2. Can reach the remote source (in which case we cache that image)
  3. Display a default image because there is no cached, or remote image

Implement some basic base64 encode checks

The goal here is to catch media which was not correctly encoded and cached.

If it fails the test, we should - only once - remove the media locally and then attempt to cache the media again.

Add Callbacks

Mimic the call backs in the jquery ajax function
-always
-done
-fail

Dropping cached image in IndexedDB storage and rebuild image

I'm sure I am not understanding something correctly but I am having a little trouble dropping a cached image and then causing it to be re-cached with an updated image. I am using the IndexedDB storage. I execute "$.fn.cacheImages.drop" to drop a specific image and then want to re-cache an updated image. The drop appears to be working ok according to the "Resources" tab in Chrome but the re-cache of the image seems to be finding an image already cached. What am I doing wrong? The following is my code:

$.fn.cacheImages.drop(v_charturlactuals, v_storagePrefix);
$('.summarychartimgactuals'+obj.SUMMARY_TESTNUM_ID).cacheImages( {storagePrefix: v_storagePrefix, url: v_charturlactuals} );

I appreciate your help and patience if this is a dumb question.

Abstract the actual caching into a javascript function

This would allow for the caching of an image via it's remote URL without having to explicitly place it into the DOM. Could be very handy for html5 web apps that are attempting to make offline storage possible.

cacheImageFetchURL('http://thisfantast.ic/selfie.jpg');

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.