image url in yii2

i can’t get the image from directory, somebody help me please

this code shows images in my folder


$images_url =  Yii::getAlias('@web/assets')."/../../modules/WebForm/assets";

i want that image here.


"<button type='button' class='trigger'><img src='{$image_url}/images/calendar.gif' alt='Popup'></button>"

How to access help me please.

You cannot do it like that because ‘src’ has to be accessible url and since you point to ‘modules’ it is not.

You can either publish the assets images which copies or links them to web accessible folder or you can prepare mechanism that serves the required image content when called.

Read this guide http://www.yiiframework.com/doc-2.0/guide-structure-assets.html

i am getting link of image to web accessible folder but i can’t getting from there.

can i access like below code,


$images_url =  Yii::getAlias('@web/assets')."/../../modules/WebForm/assets";

as {$images_url}. Is this right.