You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Stephan Beltran <st...@gmail.com> on 2012/02/03 00:21:12 UTC

Custom Asset Source for Images

Hello,

I am currently trying to figure out how I may go about writing a custom
asset source specifically for retrieving images. The way we want it set up
is that we want an asset source that we can pass a location and id to, and
return an image location retrieved from the database, which will then
retrieve an Image Asset in it's place. What would be the best way to go
about doing this?
Thanks!

Re: Custom Asset Source for Images

Posted by Paul Stanton <pa...@mapshed.com.au>.
This should give you an idea.

Pseudo code:

create a service ie YourImageService

Inject into it AssetSource and YourDao (or however you have implemented 
data access)

implement your logic:

YourImageService
{
     Asset getImageAsset(location, id)
     {
         return assetSource.getContextAsset("images/" + 
yourDao.getImageName(location, id));
     }
}

@Inject YourImageService into your component.

Hope that helps.


On 3/02/2012 10:21 AM, Stephan Beltran wrote:
> Hello,
>
> I am currently trying to figure out how I may go about writing a custom
> asset source specifically for retrieving images. The way we want it set up
> is that we want an asset source that we can pass a location and id to, and
> return an image location retrieved from the database, which will then
> retrieve an Image Asset in it's place. What would be the best way to go
> about doing this?
> Thanks!
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org