If you have all your images in one directory (%context%/images) then you can
use this:
<map:match pattern="**/*.jpg">
<map:read src="context://images/{2}.jpg" mime-type="image/jpeg"/>
</map:match>
This will redirect all requests like:
docs/samples/pages/images/img.jpg <-- this is what you get with your src
attribute
to %context%/images
This is not a good solution, but it works and you can use simply <img
src="images/img.jpg" /> everywhere. But if you want to classify your images
by directories then you will need something else...
Regards,
Konstantin Piroumian
> Thanks everyone,
>
> Accessing the images directly works fine and so does prefixing the url
with
> ../ (path back to webapp root) but my understanding was that the sitemap
> provided a total abstraction between the url fetched by the browser
> "images/my_image.jpg" and the actual file on disk.
>
> Prefixing my URLs so that they are relative to the current page seems a
> little hardcoded to me.
>
> Isn't the request for the image processed by the sitemap?
>
> Thanks,
>
> Chris
>
> > -----Original Message-----
> > From: Tibi DONDERA [mailto:[EMAIL PROTECTED]]
> > Sent: 22 August 2001 15:31
> > To: [EMAIL PROTECTED]
> > Subject: Re: can't match images in sitemap
> >
> >
> > IMHO,
> >
> > Your configuration seems right. I bet that using
> >
> > <cocoon address>/images/my_image.jpg
> > will give you the image.
> >
> > But the tag that is in your page should be <img
> > src="../images/my_image.jpg">
> > After all, the URL of the page is
> >
> > <cocoon address>/pages/my_page.html,
> >
> > right?
> >
> > Hope this helps.
> >
> >
> > ----- Original Message -----
> > From: "Chris Newland" <[EMAIL PROTECTED]>
> > To: "Cocoon-Users" <[EMAIL PROTECTED]>
> > Sent: Wednesday, August 22, 2001 4:10 PM
> > Subject: C2: can't match images in sitemap
> >
> >
> > > Hi All,
> > >
> > > I'm trying to add a map:match to my sitemap to fetch images but they
are
> > not
> > > fetched (my fault, Cocoon2 is working great)
> > >
> > > Location of my files:
> > >
> > > tomcat/webapps/cocoon/docs/samples/pages/my_page.xsp
> > > tomcat/webapps/cocoon/docs/samples/images/my_image.jpg
> > > tomcat/webapps/cocoon/stylesheets/my_xsl.xsl
> > >
> > > sitemap entries:
> > >
> > > <map:match pattern="pages/*">
> > > <map:generate type="serverpages" src="docs/samples/pages/{1}.xsp"/>
> > > <map:transform src="stylesheets/my_xsl"/>
> > > </map:match>
> > >
> > > (loads + processes XSP page fine)
> > >
> > > <map:match pattern="images/**.jpg">
> > > <map:read src="docs/samples/images/{1}.jpg" mime-type="image/jpg"/>
> > > </map:match>
> > >
> > > (does not return the image)
> > >
> > > The returned HTML contains:
> > >
> > > <img src="images/my_image.jpg">
> > >
> > > As far as I can see, this is the same way that the cocoon.gif image is
> > > fetched from samples.xml but I can't see what I'm doing wrong.
> > >
> > > Any help would be appreciated.
> > >
> > > Thanks,
> > >
> > > Chris
> > >
> > > --
> > > Chris Newland
> > > Software Research Engineer
> > >
> > > Emorphia Ltd
> > > Registered in England. 4133002
> > > Mill House, Station Approach, Harlow Mill, Harlow, Essex, CM20 2EL, UK
> > >
> > > Email: [EMAIL PROTECTED]
> > > Tel: +44 (0)1279 450100
> > > Fax: +44 (0)1279 450102
> > >
> > > Check out FIPA-OS at http://fipa-os.sourceforge.net/
> > >
> > > This message may contain information proprietary to Emorphia so any
> > > unauthorised disclosure, copying or distribution of its contents is
> > strictly
> > > prohibited.
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > Please check that your question has not already been answered in the
> > > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> > >
> > > To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> > > For additional commands, e-mail: <[EMAIL PROTECTED]>
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> > For additional commands, e-mail: <[EMAIL PROTECTED]>
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>