Hannah J Swystun Hannah J Swystun - 5 months ago 48
HTML Question

SRC = routes assets (dynamic URL by user connected)?

Does someone knows how to make a source of routes.assets dynamic please ?
for example :
I have an image on my template FILE.SCALA.HTML such as :

<img src="@routes.Assets.at("images/users/aam.jpg")" class="user-image" alt="User Image @user.username">

aam.jpg == @user.username+.jpg

can someone told me how to concatenate this inside a source of (@routes.assets....)

Thank you in advance.


Did you try something like this?

<img src="@routes.Assets.at("images/users/"+user.username+".jpg")" class="user-image" alt="User Image @user.username">

Sorry but I couldn't test it myself