Hannah J Swystun Hannah J Swystun - 1 year ago 94
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 Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download