sunlabs.brazil.sunlabs
Class DataImageTemplate

java.lang.Object
  extended by sunlabs.brazil.template.Template
      extended by sunlabs.brazil.sunlabs.DataImageTemplate (view source)
All Implemented Interfaces:
TemplateInterface

public class DataImageTemplate
extends Template

Template for including images inline, using data URL's. Replaces:

  <img src=foo.gif inline=true ...>
 
with
  <img src=data:image/gif;base64,[base-64 encoded image data]" ...>
 
cache=n
The number of images to cache (defaults to 50).
max=n
The max size (in bytes) for images to inline.
all=true
Inline images if the "inline" tag is missing. If "inline=false" is specified, the image is not inlined, even if "all" is true.
force=true
Don't use the cached version of the image. This is useful when an image is changed on disk. "force" updates the cache entry (if any) with the new image.


Nested Class Summary
static class DataImageTemplate.Cache
          Keep a cache of filename/data pairs in LRU order.
 
Field Summary
 
Fields inherited from class sunlabs.brazil.template.Template
debug
 
Constructor Summary
DataImageTemplate()
           
 
Method Summary
 boolean init(RewriteContext hr)
          Initialize the cache (if any) on the first page load.
 void tag_img(RewriteContext hr)
          Replace "src=xxx" with the "data" url equivalent, if appropriate.
 
Methods inherited from class sunlabs.brazil.template.Template
done
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataImageTemplate

public DataImageTemplate()
Method Detail

init

public boolean init(RewriteContext hr)
Initialize the cache (if any) on the first page load.

Specified by:
init in interface TemplateInterface
Overrides:
init in class Template

tag_img

public void tag_img(RewriteContext hr)
Replace "src=xxx" with the "data" url equivalent, if appropriate. Remove "inline" attribute, if present.


Version Kenai-svn-r24, Generated 08/18/09
Copyright (c) 2001-2009, Sun Microsystems.