Great example - similar to an example on the Wiki ...

Note that 'createActionLink' was deprecated ...

http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/ComponentResources.html#createActionLink(java.lang.String,%20boolean,%20java.lang.Object..
.)

*Deprecated.* *Use createEventLink(String,
Object[])<http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/ComponentResources.html#createEventLink%28java.lang.String,%20java.lang.Object...%29>instead
*
-Luther



On Thu, Mar 12, 2009 at 9:42 PM, Daniel Jones <d...@murieston.com> wrote:

>
> Hi Peter,
>
> I'm using nabble to post and it seems to have stripped out the img tag.
>
> you need an img tag in your template and set the src attribute to
> ${imagePath}
>
> img src="${imagePath}"
>
> Hope this helps,
> Daniel
>
>
> Peter Kanze wrote:
> >
> > Hi Daniel,
> >
> > Thanks for your example. I tried this one, but the Object onImage is
> never
> > called when the page loads.
> > I am using Tapestry 5.1. The code is equal to your example.
> >
> > What could I do wrong?
> >
> > regards,
> > Peter
> >
> > On Thu, Mar 12, 2009 at 10:54 AM, Daniel Jones <d...@murieston.com>
> wrote:
> >
> >>
> >> PAGE CLASS
> >>
> >> inject component resources so that you can create an action link
> >>    @Inject
> >>    private ComponentResources mComponentResources;
> >>
> >> when the path is requested by the template, create and return an action
> >> link
> >>        public Link getImagePath() {
> >>                return mComponentResources.createActionLink("image",
> >> false,
> >> mItem.getID());
> >>        }
> >>
> >> handle this action link
> >>        public Object onImage(long pID) {
> >> "StreamResponseBuilder" is a class that I have implemented, it basically
> >> figures out what image to served based on
> >> the id passed in the context and then gets an "InputStream" for the
> image
> >> file on disk and creates and returns a "StreamResponse", so essentially
> >> you
> >> want this action handler to return a "StreamResponse" of the image you
> >> want
> >> to display.
> >>                return StreamResponseBuilder.getItemImage(pID);
> >>        }
> >>
> >> PAGE TEMPLATE
> >>
> >> ${imagePath}
> >>
> >> Hope this helps
> >> Regards,
> >> Daniel
> >>
> >>
> >>
> >> Peter Kanze wrote:
> >> >
> >> > Hello
> >> >
> >> > I want to load images from the filesystem, like for example
> >> > D:/category/1/products/55/thumb.jpg
> >> >
> >> > So the file path is dynamic and is based on the categoryId and the
> >> > productId.
> >> >
> >> > How can I load such an image into my webpage using a Tapestry Asset?
> >> > This looks like a common usecase to me, but I couldn't find any info
> >> about
> >> > it.
> >> >
> >> > Has somebody already done this? And could he/she show me some code
> >> > examples?
> >> > Any help is welcome!
> >> >
> >> > Thanks,
> >> > Peter
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/T5%3A-How-to-load-image-Asset-from-filesystem--tp22433419p22471474.html
> >> Sent from the Tapestry - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/T5%3A-How-to-load-image-Asset-from-filesystem--tp22433419p22489180.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to