Reputation: 23
in play framework I want to show an image not in the /public folder, for the images in the /public folder I can write:
<th><img class="ui" src="@routes.Assets.at("images/ui_iron.png")"/></th>
and put the image in the /public/image folder,but how can I use images not in the public folder,I Tried like this but not work:
GET /configimage/*file controllers.Assets.at(path="../data/public",file)
or I should new a function like controllers.Assets.at
Upvotes: 2
Views: 1370
Reputation: 2067
If your goal is just to be able to show images outside public folder you have 2 options:
unmanagedResourceDirectories in Assets += baseDirectory.value / "data"
No need to change the routes files, as all the files inside data will be merged into the public directory during compilation.
You can define different routes for different groups of assets but if you do that in your html file you will need to pass 2 arguments to the Assets.at method one for the path in the routes and one for the file.
ReferenceAs in Asset mapping outside public folder on Play framework
Upvotes: 4