You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2007/08/30 11:16:57 UTC
T5: Handling of images
Hi,
Everytime I need to display an image, I have to do something like this:
@Inject
@Path("context:/images/logo3.jpg")
private Asset logo;
public Asset getLogo() {
return logo;
}
then in the template:
${logo}
Is there an easier way? example, I can directly refer to the image without
creating a function?
Thanks,
A.C.
--
View this message in context: http://www.nabble.com/T5%3A-Handling-of-images-tf4352985.html#a12403455
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Handling of images
Posted by Nick Westgate <ni...@key-planning.co.jp>.
An even better solution IMO is to revive the Img component,
but move the domain into another parameter defaulted to "context".
Source here, renamed Image:
http://wiki.apache.org/tapestry/Tapestry5ImageComponent
E.g.
<img t:type="Image" src="images/other/header.gif" border="0"/>
Cheers,
Nick.
Nick Westgate wrote:
> Situations like this are exactly where it's needed.
> I think it was removed prematurely.
>
> You can just re-add the component and use it:
> http://wiki.apache.org/tapestry/Tapestry5AnyComponent
>
> There are another couple of example uses there.
>
> Cheers,
> Nick.
>
>
> Ted Steen wrote:
>> Actually I dont think the Any component exists anymore.. its not
>> needed because of expansions in attributes.
>>
>> 2007/8/30, Nick Westgate <ni...@key-planning.co.jp>:
>>> Sorry, that should be (still not ideal) ...
>>> <img t:type="Any" t:src="asset:context:images/blah.gif
>>> src="images/blah.gif""/>
>>>
>>> Cheers,
>>> Nick.
>>>
>>>
>>> Nick Westgate wrote:
>>>> Why don't you read about it here:
>>>> http://tapestry.apache.org/tapestry5/tapestry-core/guide/assets.html
>>>>
>>>> For instance, assets can be localized.
>>>>
>>>> Also, the Any component can be used to help previewability, e.g:
>>>> <img t:type="Any" src="asset:context:images/blah.gif"/>
>>>>
>>>> Cheers,
>>>> Nick.
>>>>
>>>>
>>>> Angelo Chen wrote:
>>>>> Hi,
>>>>> Both of your suggestions work, thanks, I was doing it hard way.
>>>>> btw, what's the difference: ${asset:context:img/ok0.gif} and
>>>>> img/ok0.gif
>>>>>
>>>>> A.C.
>>>>>
>>>>>
>>>>> Filip S. Adamsen-2 wrote:
>>>>>> You can also specify assets inline using the asset prefix, that is:
>>>>>>
>>>>>> ${asset:context:img/ok0.gif}
>>>>>> Works like a charm.
>>>>>>
>>>>>> Robin Helgelin skrev:
>>>>>>> On 8/30/07, Erik Vullings <er...@gmail.com> wrote:
>>>>>>>> Hi Angelo,
>>>>>>>>
>>>>>>>> Can't you just use (in the HTML part of your page):
>>>>>>>> img/ok0.gif
>>>>>>>> and put the ok0.gif image in the src/main/webapp/img folder.
>>>>>>> You could, but then you would get a wrong url when you are using an
>>>>>>> action or something on your page, such as /mypage/action1/action2,
>>>>>>> then the image would be /mypage/action1/img/ok0.gif which is
>>>>>>> non-existing.
>>>>>>>
>>>>>>> The asset service takes care of all this for you.
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Handling of images
Posted by Nick Westgate <ni...@key-planning.co.jp>.
Situations like this are exactly where it's needed.
I think it was removed prematurely.
You can just re-add the component and use it:
http://wiki.apache.org/tapestry/Tapestry5AnyComponent
There are another couple of example uses there.
Cheers,
Nick.
Ted Steen wrote:
> Actually I dont think the Any component exists anymore.. its not
> needed because of expansions in attributes.
>
> 2007/8/30, Nick Westgate <ni...@key-planning.co.jp>:
>> Sorry, that should be (still not ideal) ...
>> <img t:type="Any" t:src="asset:context:images/blah.gif src="images/blah.gif""/>
>>
>> Cheers,
>> Nick.
>>
>>
>> Nick Westgate wrote:
>>> Why don't you read about it here:
>>> http://tapestry.apache.org/tapestry5/tapestry-core/guide/assets.html
>>>
>>> For instance, assets can be localized.
>>>
>>> Also, the Any component can be used to help previewability, e.g:
>>> <img t:type="Any" src="asset:context:images/blah.gif"/>
>>>
>>> Cheers,
>>> Nick.
>>>
>>>
>>> Angelo Chen wrote:
>>>> Hi,
>>>> Both of your suggestions work, thanks, I was doing it hard way.
>>>> btw, what's the difference: ${asset:context:img/ok0.gif} and img/ok0.gif
>>>>
>>>> A.C.
>>>>
>>>>
>>>> Filip S. Adamsen-2 wrote:
>>>>> You can also specify assets inline using the asset prefix, that is:
>>>>>
>>>>> ${asset:context:img/ok0.gif}
>>>>> Works like a charm.
>>>>>
>>>>> Robin Helgelin skrev:
>>>>>> On 8/30/07, Erik Vullings <er...@gmail.com> wrote:
>>>>>>> Hi Angelo,
>>>>>>>
>>>>>>> Can't you just use (in the HTML part of your page):
>>>>>>> img/ok0.gif
>>>>>>> and put the ok0.gif image in the src/main/webapp/img folder.
>>>>>> You could, but then you would get a wrong url when you are using an
>>>>>> action or something on your page, such as /mypage/action1/action2,
>>>>>> then the image would be /mypage/action1/img/ok0.gif which is
>>>>>> non-existing.
>>>>>>
>>>>>> The asset service takes care of all this for you.
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Handling of images
Posted by Ted Steen <te...@gmail.com>.
Actually I dont think the Any component exists anymore.. its not
needed because of expansions in attributes.
2007/8/30, Nick Westgate <ni...@key-planning.co.jp>:
> Sorry, that should be (still not ideal) ...
> <img t:type="Any" t:src="asset:context:images/blah.gif src="images/blah.gif""/>
>
> Cheers,
> Nick.
>
>
> Nick Westgate wrote:
> > Why don't you read about it here:
> > http://tapestry.apache.org/tapestry5/tapestry-core/guide/assets.html
> >
> > For instance, assets can be localized.
> >
> > Also, the Any component can be used to help previewability, e.g:
> > <img t:type="Any" src="asset:context:images/blah.gif"/>
> >
> > Cheers,
> > Nick.
> >
> >
> > Angelo Chen wrote:
> >> Hi,
> >> Both of your suggestions work, thanks, I was doing it hard way.
> >> btw, what's the difference: ${asset:context:img/ok0.gif} and img/ok0.gif
> >>
> >> A.C.
> >>
> >>
> >> Filip S. Adamsen-2 wrote:
> >>> You can also specify assets inline using the asset prefix, that is:
> >>>
> >>> ${asset:context:img/ok0.gif}
> >>> Works like a charm.
> >>>
> >>> Robin Helgelin skrev:
> >>>> On 8/30/07, Erik Vullings <er...@gmail.com> wrote:
> >>>>> Hi Angelo,
> >>>>>
> >>>>> Can't you just use (in the HTML part of your page):
> >>>>> img/ok0.gif
> >>>>> and put the ok0.gif image in the src/main/webapp/img folder.
> >>>> You could, but then you would get a wrong url when you are using an
> >>>> action or something on your page, such as /mypage/action1/action2,
> >>>> then the image would be /mypage/action1/img/ok0.gif which is
> >>>> non-existing.
> >>>>
> >>>> The asset service takes care of all this for you.
> >>>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>
> >>>
> >>>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
/ted
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Handling of images
Posted by Nick Westgate <ni...@key-planning.co.jp>.
Sorry, that should be (still not ideal) ...
<img t:type="Any" t:src="asset:context:images/blah.gif src="images/blah.gif""/>
Cheers,
Nick.
Nick Westgate wrote:
> Why don't you read about it here:
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/assets.html
>
> For instance, assets can be localized.
>
> Also, the Any component can be used to help previewability, e.g:
> <img t:type="Any" src="asset:context:images/blah.gif"/>
>
> Cheers,
> Nick.
>
>
> Angelo Chen wrote:
>> Hi,
>> Both of your suggestions work, thanks, I was doing it hard way.
>> btw, what's the difference: ${asset:context:img/ok0.gif} and img/ok0.gif
>>
>> A.C.
>>
>>
>> Filip S. Adamsen-2 wrote:
>>> You can also specify assets inline using the asset prefix, that is:
>>>
>>> ${asset:context:img/ok0.gif}
>>> Works like a charm.
>>>
>>> Robin Helgelin skrev:
>>>> On 8/30/07, Erik Vullings <er...@gmail.com> wrote:
>>>>> Hi Angelo,
>>>>>
>>>>> Can't you just use (in the HTML part of your page):
>>>>> img/ok0.gif
>>>>> and put the ok0.gif image in the src/main/webapp/img folder.
>>>> You could, but then you would get a wrong url when you are using an
>>>> action or something on your page, such as /mypage/action1/action2,
>>>> then the image would be /mypage/action1/img/ok0.gif which is
>>>> non-existing.
>>>>
>>>> The asset service takes care of all this for you.
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Handling of images
Posted by Nick Westgate <ni...@key-planning.co.jp>.
Why don't you read about it here:
http://tapestry.apache.org/tapestry5/tapestry-core/guide/assets.html
For instance, assets can be localized.
Also, the Any component can be used to help previewability, e.g:
<img t:type="Any" src="asset:context:images/blah.gif"/>
Cheers,
Nick.
Angelo Chen wrote:
> Hi,
>
> Both of your suggestions work, thanks, I was doing it hard way.
> btw, what's the difference: ${asset:context:img/ok0.gif} and img/ok0.gif
>
> A.C.
>
>
> Filip S. Adamsen-2 wrote:
>> You can also specify assets inline using the asset prefix, that is:
>>
>> ${asset:context:img/ok0.gif}
>>
>> Works like a charm.
>>
>> Robin Helgelin skrev:
>>> On 8/30/07, Erik Vullings <er...@gmail.com> wrote:
>>>> Hi Angelo,
>>>>
>>>> Can't you just use (in the HTML part of your page):
>>>> img/ok0.gif
>>>>
>>>> and put the ok0.gif image in the src/main/webapp/img folder.
>>> You could, but then you would get a wrong url when you are using an
>>> action or something on your page, such as /mypage/action1/action2,
>>> then the image would be /mypage/action1/img/ok0.gif which is
>>> non-existing.
>>>
>>> The asset service takes care of all this for you.
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Handling of images
Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi,
Both of your suggestions work, thanks, I was doing it hard way.
btw, what's the difference: ${asset:context:img/ok0.gif} and img/ok0.gif
A.C.
Filip S. Adamsen-2 wrote:
>
> You can also specify assets inline using the asset prefix, that is:
>
> ${asset:context:img/ok0.gif}
>
> Works like a charm.
>
> Robin Helgelin skrev:
>> On 8/30/07, Erik Vullings <er...@gmail.com> wrote:
>>> Hi Angelo,
>>>
>>> Can't you just use (in the HTML part of your page):
>>> img/ok0.gif
>>>
>>> and put the ok0.gif image in the src/main/webapp/img folder.
>>
>> You could, but then you would get a wrong url when you are using an
>> action or something on your page, such as /mypage/action1/action2,
>> then the image would be /mypage/action1/img/ok0.gif which is
>> non-existing.
>>
>> The asset service takes care of all this for you.
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/T5%3A-Handling-of-images-tf4352985.html#a12404597
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Handling of images
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
You can also specify assets inline using the asset prefix, that is:
<img src="${asset:context:img/ok0.gif}" title="ok0" height="28"
width="37"/>
Works like a charm.
Robin Helgelin skrev:
> On 8/30/07, Erik Vullings <er...@gmail.com> wrote:
>> Hi Angelo,
>>
>> Can't you just use (in the HTML part of your page):
>> <img src="img/ok0.gif" title="ok0" height="28" width="37"/>
>>
>> and put the ok0.gif image in the src/main/webapp/img folder.
>
> You could, but then you would get a wrong url when you are using an
> action or something on your page, such as /mypage/action1/action2,
> then the image would be /mypage/action1/img/ok0.gif which is
> non-existing.
>
> The asset service takes care of all this for you.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Handling of images
Posted by Robin Helgelin <lo...@gmail.com>.
On 8/30/07, Erik Vullings <er...@gmail.com> wrote:
> Hi Angelo,
>
> Can't you just use (in the HTML part of your page):
> <img src="img/ok0.gif" title="ok0" height="28" width="37"/>
>
> and put the ok0.gif image in the src/main/webapp/img folder.
You could, but then you would get a wrong url when you are using an
action or something on your page, such as /mypage/action1/action2,
then the image would be /mypage/action1/img/ok0.gif which is
non-existing.
The asset service takes care of all this for you.
--
regards,
Robin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Handling of images
Posted by Erik Vullings <er...@gmail.com>.
Hi Angelo,
Can't you just use (in the HTML part of your page):
<img src="img/ok0.gif" title="ok0" height="28" width="37"/>
and put the ok0.gif image in the src/main/webapp/img folder.
Cheers
Erik
On 8/30/07, Angelo Chen <an...@yahoo.com.hk> wrote:
>
>
> Hi,
>
> Everytime I need to display an image, I have to do something like this:
>
> @Inject
> @Path("context:/images/logo3.jpg")
>
> private Asset logo;
>
> public Asset getLogo() {
> return logo;
> }
>
> then in the template:
>
> ${logo}
>
> Is there an easier way? example, I can directly refer to the image without
> creating a function?
>
> Thanks,
>
> A.C.
>
> --
> View this message in context:
> http://www.nabble.com/T5%3A-Handling-of-images-tf4352985.html#a12403455
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>