RE: Image treatment

2007-06-19 Thread Ard Schrijvers

 lfhc pisze:
  Hi,
  what I'm trying to do is to transform this :
  
  xml ...
  
  imagehttp://sourceurl/path/image.jpg/image
  
  to
  
  http://cocoonurl/image.jpg  where this image is resized.


 
 You need something like this:
 map:match pattern=images/**
map:read type=image-op-scale 
 src=cached:http://sourceurl/{1}?cocoon:cache-expires=60cocoo
 n:cache-name=cached-images/
 /map:match

Don't you think it would be much easier to use mod_cache between the browser 
and cocoon to handle the caching of binary files like these? Furthermore, 
making sure the reader gets a correct expires value in the component 
configuration makes the images properly cacheable by browsers too (if mod_cache 
honours the ttl headers of cocoon of course)

So, for example, in your components, declare:

map:reader name=image src=org.apache.cocoon.reading.ImageReader 
logger=sitemap.reader.image pool-max=32 pool-min=1 pool-grow=4
  parameter name=expires value=8640/
/map:reader

And have a matcher

map:match pattern=readImage/*/*/** 
map:read src={2} type=image
map:parameter name=width value={1}/
map:parameter name=height value={2}/
/map:read
/map:match

This should do the trick. If you insist on caching it in cocoon as well, of 
course you can use the wrapped src suggestion of Grzegorz

Regards Ard


 
 This way you will get proxy-like behaviour thanks to Cocoon's 
 cached: protocol thus avoiding re-downloading original images 
 again and again.
 
 For description of cached source, take a look at: 
 http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/compone
 nts/source/impl/CachingSource.html
 
 -- 
 Grzegorz Kossakowski
 http://reflectingonthevicissitudes.wordpress.com/
 
 -
 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]



RE: Image treatment

2007-06-18 Thread Geert Josten
Could you give more hints about what you are trying to achieve exactly.
To my knowledge, it should be possible to read with any protocol known
to Cocoon, but where should the result go, once transformed? And are you
trying to process multiple images in one pass? Try transforming just one
for starters..

Kind regards,
Geert

 
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.
 

 From: lfhc [mailto:[EMAIL PROTECTED] 
 Sent: maandag 18 juni 2007 13:21
 To: users@cocoon.apache.org
 Subject: Image treatment
 
 
 Hi,
 I needed to have some image treatment done, and I've been 
 looking through ImageReader. Yet, my assumption is that this 
 module only gets images from a filesystem, and I needed to 
 get them through an http source.
 
 For example, I have a content source for news, that gives me 
 an url for the images uploaded. With that content source, I 
 want to build html pages, but that image url cannot be the 
 original one, but one from cocoon, and, if possible, have 
 some resizing done.
 
 Can anyone point me in the right direction please?
 
 Thank you,
 Best Regards,
 Luis Carvalho.
 --
 View this message in context: 
 http://www.nabble.com/Image-treatment-tf3939701.html#a11173889
 Sent from the Cocoon - Users mailing list archive at Nabble.com.
 
 
 -
 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]



RE: Image treatment

2007-06-18 Thread lfhc

Hi,
what I'm trying to do is to transform this :

xml ...

imagehttp://sourceurl/path/image.jpg/image

to

http://cocoonurl/image.jpg  where this image is resized.

Thank you,
Best Regards,
Luis Carvalho.


Geert Josten wrote:
 
 Could you give more hints about what you are trying to achieve exactly.
 To my knowledge, it should be possible to read with any protocol known
 to Cocoon, but where should the result go, once transformed? And are you
 trying to process multiple images in one pass? Try transforming just one
 for starters..
 
 Kind regards,
 Geert
 
 

  
 Drs. G.P.H. Josten
 Consultant
  
  
 
 Daidalos BV
 Source of Innovation
 Hoekeindsehof 1-4
 2665  JZ  Bleiswijk
 Tel.: +31 (0) 10 850 1200
 Fax: +31 (0) 10 850 1199
 www.daidalos.nl
 KvK 27164984
 
 
 De informatie - verzonden in of met dit emailbericht - is afkomstig van
 Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit
 bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan
 dit bericht kunnen geen rechten worden ontleend.
  
 
 From: lfhc [mailto:[EMAIL PROTECTED] 
 Sent: maandag 18 juni 2007 13:21
 To: users@cocoon.apache.org
 Subject: Image treatment
 
 
 Hi,
 I needed to have some image treatment done, and I've been 
 looking through ImageReader. Yet, my assumption is that this 
 module only gets images from a filesystem, and I needed to 
 get them through an http source.
 
 For example, I have a content source for news, that gives me 
 an url for the images uploaded. With that content source, I 
 want to build html pages, but that image url cannot be the 
 original one, but one from cocoon, and, if possible, have 
 some resizing done.
 
 Can anyone point me in the right direction please?
 
 Thank you,
 Best Regards,
 Luis Carvalho.
 --
 View this message in context: 
 http://www.nabble.com/Image-treatment-tf3939701.html#a11173889
 Sent from the Cocoon - Users mailing list archive at Nabble.com.
 
 
 -
 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]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Image-treatment-tf3939701.html#a11174965
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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



Re: Image treatment

2007-06-18 Thread Grzegorz Kossakowski

lfhc pisze:

Hi,
what I'm trying to do is to transform this :

xml ...

imagehttp://sourceurl/path/image.jpg/image

to

http://cocoonurl/image.jpg  where this image is resized.


You need something like this:
map:match pattern=images/**
  map:read type=image-op-scale 
src=cached:http://sourceurl/{1}?cocoon:cache-expires=60cocoon:cache-name=cached-images/
/map:match

This way you will get proxy-like behaviour thanks to Cocoon's cached: protocol 
thus avoiding re-downloading original images again and again.

For description of cached source, take a look at: 
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/source/impl/CachingSource.html


--
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/

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