You can achieve the same result by chaining the already existing imagereader with the databasereader, thus having the databasereader read the image and the imagereader scale it.

I use the following (beware that in 2.1.5 this leaks database connections, fixed in 2.1.6):

<map:match pattern="resource/*">
        <map:read type="databasereader" src="{1}">
                <map:parameter name="table" value="cmsresource"/>
                <map:parameter name="image" value="content"/>
                <map:parameter name="key" value="ID"/>
                <map:parameter name="content-type" value="mimetype"/>
        </map:read>
</map:match>

<map:match pattern="preview/*">
        <map:read type="swiftimage" src="cocoon:/resource/{1}" 
mime-type="image/jpeg">
                <map:parameter name="width" value="50"/>
                <map:parameter name="height" value="50"/>
                <map:parameter name="expires" value="86400000"/>
        </map:read>
</map:match>

G.
P.S.: if you really plan to use this you better apply a filter to the pattern to prevent SQL injection


Philippe Guillard wrote:

Grzegorz Ta�czyk wrote:

Hello Philippe,

I can send You source of my custom reader(database and image
readers connection). It takes three parameters: width, height and
quality.
It is not very professional, so I think that I shouldn't add it to any repository :))


Monday, January 10, 2005, 6:20:54 PM, you wrote:
PG> Hi all,

PG> I discovered imagereader is able to reduce the image size in terms of kb
PG> for light image display with paramters width and height. I'd like to do
PG> the same with the databasereader. I'd like to know if somebody did it
PG> and if that makes sense.


PG> Regards,

PG> Phil



PG> ---------------------------------------------------------------------
PG> To unsubscribe, e-mail: [EMAIL PROTECTED]
PG> For additional commands, e-mail: [EMAIL PROTECTED]






Would be great! i'm not good in java, sure i will not criticize :-)
Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to