[Seaside] serve jpg image files from form objects

goran at krampe.se goran at krampe.se
Thu Jun 1 06:59:36 UTC 2006


Martin Schubert <martin.schubert at informatik.uni-ulm.de> wrote:
> hello out there,
> allthough i browsed throught the archives i couldn`t find the answer  
> to my problem.

As perSeaside2.6a3-avi.7 (21 January 2006, 8:10:38 pm), Avi merged my
WACachedDocument class into Seaside, and this is the class comment:
This class is for serving smallish files like PNG images etc using
WADocumentHandler. Using the Canvas API for HTML generation you simply
do this:

	html image fileName: 'myimage.png'


	html image fileName: 'myimage.blurp' mimeType: 'blurp'

This will create a request handler in your WAApplication registry that
is accessible on a unique URL and does not expire.
The actual contents of the file will only be read upon first access, we
could augment this class with smarter caching, like checking the
modification time on disk.

The class has a Cache class var holding a Dictionary of created
instances so you can clear and preload files into the image using:

		fileName: 'myimage.png';
		fileName: 'another.gif'; "etc"


cheers, Göran

More information about the Seaside mailing list