XAO-ImageCache
view release on metacpan or search on metacpan
CONFIGURATION PARAMETERS
The set of configuration parameters contain required and optional
parameters.
Required parameters should be defined. Execution will be stoped if
required parameter not present.
Optional parameters just configure aditional functionality and may not
present.
Required parameters
cache_path
- Path string where the cache should be placed.
May be absolute or relative from current execution directory path.
For example. Set it to "./cache" if you whant to place cache in
"cache" subdirectory of your script working directory.
cache_url
- complet URL (or relative location) to cached images.
Place here your URL reflection of cache directory in condition with
your HTTP server configuration.
For example. Set it to "http://my.host.com/images/" if your HTTP
server configured for provide access to your cache directory by
hostname "my.host.com" and location "images/". Cached images names
will be added to image URL automaticaly.
list
- reference to "XAO::DO::FS::List" object containing the data
objects with Image source URL
Meaning, your data look like a XAO Foundation Server list of objects
with references to images. This parameter should contain reference
to to XAO::DO::FS::List object. This reference may be result of
XAO::Objects->fetch() methode.
XAO::ImageCache will process each record of this list.
source_url_key
- data key containing the URL of source image.
Contain the name of key of data object containing the source image
reference.
Optional parameters
dest_url_key
- data key for storing URL of image in cache.
Optional parameter cause image name in cache will be a MD5 Base64
digest of source image path where "=" character removed, "\" and "+"
translated to "_" and "-" simultaniosely.
To get cached image name
size
- Prefered image size may set as "geometry" equal to "geometry"
parameter of Image::Magick module to pass it dirrectly to
Image::Magick Scale function.
Other way to set the image size is set a width and height keys to
preffered values.
If one of image dimension is not defined then corresponding
parameter of original image will be used.
This way, image will be resized with same aspect ratio (same
proportions) to the original image if "save_aspect_ratio" parameter
present.
Image width and height will be resized exactly to given size if
"save_aspect_ratio" parameter not present.
Parameter "geometry" has higher priority and other parameters has no
effects if "geometry" peresent.
For example.
# Size 320x200 as geometry settings
%params = (size => {geometry => "320x200!"} );
# Size 320x200 as dimensions settings
%params = (size => {width => 320, height => 200} );
# Fit size into 320x200 with saving image proportions
%params = (
size => {
width => 320,
height => 200,
save_aspect_ratio => 1,
}
);
autocreate
- create or check cache content automaticaly.
If non zero value present, cache directory will be created and
images checking will be runned. Otherwithe you should run init() and
check() methodes manualy.
Existent cache directory will not be removed. You may do it manualy
using remove_cache() methode.
force_download
- each image should be reloaded to cache and processed without
dependance of source image modification time. Any conditions
ignored.
thumbnail
- thumbnails creator configuration
Some thubnails configuration parameters may be set for automatic
thumbnails creation. This parameter should contain the reference to
hash with thumbnails configuration parameters.
Only "path" parameter is required. Other parameters are optional.
path
path where thumbnail images should be placed.
url URL for access to thumbnails directory. Same way as "cache_url".
url_key
Data object key name where thumbnail URL should be stored.
geometry
Geometry string to set thumbnail images size in Image Magick
geometry format. May be set as dimension ("320x200!") or as
persent of actual size of cached image ("25%").
Default value is "50%" the half of actual image size.
useragent
- configuration parameters hash for LWP::UserAgent
agent
Default value "XAO-ImageCache/#.##"
env_proxy
Default value 1
keep_alive
Default value 1
timeout
Default value 30
For more information please follow to LWP::UserAgent
SEE ALSO
Specifics of List API can be found in
XAO::DO::FS::List.
For additional information please see
XAO::DO::FS::Glue,
XAO::DO::FS::Global,
XAO::DO::FS::Glue::MySQL_DBI,
Refer to Image::Magick documentation for additional information about
setting of image scaling parameters.
Refer to LWP::UserAgent documentation for additional information about
user agent parameters.
BUGS
Please, inform me about found bugs.
AUTHORS
The XAO::ImageCache package maintained by Konstantin Safronov
<skv@xao.com>. Specification by Andrew Maltsew <am@xao.com>
( run in 0.689 second using v1.01-cache-2.11-cpan-39bf76dae61 )