Previous blank.gif blank.gif blank.gif

Function store_image_inventory - Save a dictionary listing all image objects to a file.


SYNOPSIS

import HTMLutil
def store_image_inventory(directory=os.curdir, file='images.pkl', prefix=None)

DESCRIPTION

The dictionary containing all Image objects derived from a given directory can be saved either as a pickle file to preserve the Image objects or as string HTML representations savable in a marshaled form for performance. Which form happens is a function of the file suffix given as the second argument. If it ends in ".mar" then the Image objects are flattened into plain strings and saved as a marshal file. Any other suffix, including the default ".pkl" will save the dictionary of objects as a pickle file. Note: the marshal form is about two orders of magnitude faster when fetching this dictionary.

Arguments

directory
Directory to generate Image objects from and store the resulting dictionary into.
file
Optional name of file to save into. default is "images.pkl" If the file suffix is '.mar' the Image objects will be flattened into regular strings and saved as a marshalled file, (a performance route when you know the SRC prefix ahead of time).
prefix
Optional specification of the Image prefix. Typically used when you what to specify a known URL path for your image repository, eg. http:/www.phunni.com/image.

SEE ALSO

HTMLutil


Previous blank.gif blank.gif blank.gif
Buzz.gif

Copyright © 1996-9 Robin Friedrich
All Rights Reserved
Comments to author: friedrich@pythonpros.com
Generated: Tue Apr 20, 1999