Hi Anish,
please refrain from cross-posting to the dev list. This is a usage question.
Anish schrieb:
Can anybody suggest how to use image reader in Lenya 2 (inside a module)
e.g. in lenya 1.2.4, I wrote my pipeline in publication-sitemap.xmap for
reading an image as:
<map:match pattern="**/img-*.jpg">
<map:read src="/home/anish/*.jpg" type="image"/>
</map:match>
I put name of the image in <img src="img-1.jpg"/> tag and It worked
where 1.jpg is the name of the image.
But now I want to achieve that inside a module (lenya 2.0.2). e.g. I've
a module named mymodule (..../lenya/src/modules/mymodule) I've written
the same pipeline in ..../lenya/src/modules/mymodule/sitemap.xmap like:
<map:match pattern="**/img-*.jpg">
<map:read src="/home/anish/*.jpg" type="image"/>
</map:match>
Maybe that's a copy&paste error, but you can't use an asterisk in the
source URI, but rather the placeholder (I guess that would be {2} in
your case).
and created a module type page (say page1.html), on the same page I want
to access images using <img...../> tag.
If you want to deliver the image from a module, your link must contain
the module information. There are two options:
1) <img src="/modules/mymodule/img-1.jpg"/>
2) <img src="img-1.jpg?lenya.module=mymodule"/>
In option 1), the link has to be transformed using the proxy transformer
so that the URL will be compatible with arbitrary proxy setups.
I guess in your case option 1) will be more suitable. The matcher in the
module sitemap doesn't need a prefix:
<map:match pattern="img-*.jpg">
<map:read src="/home/anish/{1}.jpg"/>
</map:match>
HTH,
-- Andreas
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]