Hannah J Swystun Hannah J Swystun - 16 days ago 7
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.

Answer

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

Comments