Using ZIP files for images


Updated December 17, 2018

As of HAniS version 4.23, HAniS can now extract your images from a single ZIP file, instead of reading every image, individually from the server. This is possible using an external library, JSZip.

Changes in your HTML

To use this feature, you must include the jszip_min.js file as one of your <script> files (along with hanis_min.js). For example, in your <head> element, you might have: <script src="hanis_min.js"></script> <script src="jszip.min.js"></script>

You may download a copy of the JSZip library file jszip.min.js by right-clicking on this link, and doing a "Save link as".
(More information about JSZip is available at: http://stuartk.com/jszip)

HAniS parameters

There are three associated HAniS configuration parameters:

zip_filename = yourzipfile.zip
which incidates the name of the ZIP file on your server. Note that if you have specified an image_base location, that will prefix this filename.

Normally, the filenames within the ZIP file should not contain any "directory" information (that is, the images should be at the top-level in the file).

zip_only = false
Normally, once you specify a zip_filename it is expected that all base and overlay images will be in the ZIP file. Any image not present, will be treated as "missing". However, by specifying a value of "false" (as shown), then if any image is not in the ZIP file, HAniS will attempt to fetch that image from the server in the usual manner.

zip_static = false
By default, it is assumed that your ZIP file is "static", so no "anti-caching" information will be added when the file is read from the server. However, if the contents of your ZIP file changes, use this parameter with a value of "false" to help insure the file is re-read from the server when an update is done.

Examples

You may not always benefit from zipping up your images -- a lot depends on the server and available networking bandwidth. We have set up 3 examples to illustrate this:
  1. All images are zipped into one ZIP file -- note the extra "progress bar" that appears when the ZIP file is loading.
  2. All images are not zipped and are fetched individually - note the "blank" display while the images are loading...this is the current HAniS default.
  3. Adding the parameter skip_missing=0  to the previous, un-zipped example, that will cause the looping to show up while images are loading.

(Thanks to Rick Kohrs of SSEC for these images!)

Return to main HAniS page


The HAniS webapp Copyright© 2014-2018 by StormQuest Technologies and Tom Whittaker

The JSZip library is Copyright© 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown.
JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/master/LICENSE