Giter Site home page Giter Site logo

burn-e99 / localimagestorage.js Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 18 KB

LocalImageStorage.JS is a simple library designed to make saving commonly loaded images to localstorage.

License: MIT License

JavaScript 100.00%
lis localstorage image javascript

localimagestorage.js's Introduction

LocalImageStorage.JS V1.0.0 (1/21/17)

A simple library designed to make saving commonly loaded images to localstorage.

LocalImageStorage.JS (Referred as LIS.JS from now on) is designed to allow you to save PNGs to the web browser's localstorage so that future loads of your website are faster and require much less bandwidth. This is especially useful when you need multiple clients to load the same set of images on a rotating set of pages when limited by network bandwidth and speed.

Setting LIS.JS up for Use

  1. First download the latest release from the release folder, and save it.
  2. Next, include the following in your HTML <head>: <script type="text/javascript" src="/path/to/LocalImageStorageVX.X.X.min.js"></script> (replacing /path/to with the path, and X.X.X with the version you are using)
  3. [OPTIONAL] To save the typing of LocalImageStorage each time you need to use it, place this code at the top of your JS files to be able to use LIS instead: var LIS = LocalImageStorage.

LIS.JS Docs

  • AddImage(String Path, String Name)
    • Adds the image to LocalStorage by using the direct path provided and then saving it under the name provided.
  • GetImage(String Name)
    • Returns the image data from LocalStorage (assuming it was Initialized or Added prior to this) to the user using the name provided.
  • RemoveImage(String Name)
    • Removes the image from LocalStorage using the name provided in the case that the user does not want it saved anymore.
  • InitializeImage(String Path, String Name)
    • Adds the image just the same as AddImage, but instead immediately returns a Promise with the image data.
  • GetAvailableSpace()
    • Returns the amount of space left in KB.
  • Version()
    • Returns the version number.

LIS.JS Wishlist

  • JPEG/JPG Support
  • Documented Code

Example Code

Please see my test bench at http://testbench.burne99.com/LIS/examples for examples and more information.

Questions?

If you come across any bugs or compatibility issues with LIS.JS, please submit an issue to this repository, and I will be sure to look into it.

License

The MIT License (MIT)

Copyright (c) 2016 Ean Milligan ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

localimagestorage.js's People

Contributors

burn-e99 avatar

Watchers

James Cloos avatar  avatar

localimagestorage.js's Issues

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.