[Seaside] [Newbie]WACachedDocument.inspect?

Michel Bany m.bany at wanadoo.fr
Fri Aug 18 21:25:16 UTC 2006


Bakki Kudva a écrit :

> Hi,
>
> Is there a way to actually see the images in the Cache of this object?
> When I do an inspect on the class variable #cache I can see that it is
> pointing to a Dictionary but cannot see what's in it. I tried inspect,
> browse etc but cannot figure out how to look inside and see what
> images and other documents are in it, say when the example counter is
> running. (which should have 'seaside-top.jpg')


The cached images are stored as raw bytes in the Smalltalk image. The 
"seaside-top"
is returned as raw bytes by class method #seasideBanner of 
SeasidePlatformSupport .
In Squeak, the inspector is not able to display those strings of bytes.

However you can turn those bytes into images using Seaside rendering 
methods.
For instance, using file names
    cache := WACachedDocument classPool at: #Cache.
    cache do:
        [:image |
        html image width: 100 px; fileName: image fullFileName].
using raw bytes
    cache do:
        [:image |
        html image width: 100 px; document: image asMIMEDocument].
using even rawer bytes
    cache do:
        [:image |
        html image width: 100 px; document: image asMIMEDocument content].
Finally to display an image from raw bytes returned by a method
    html image document: SeasidePlatformSupport seasideBanner.

Cheers
Michel.








More information about the Seaside mailing list