I'm using Yii 2.0 (Advanced Yii 2.0 Application Structure) and I am pretty newbie. Before reading a lot of documentation I think this should be the 'best practised' way of publishing-showing an image.
$path = Yii::$app->basePath.'/views/images';
$assets_url = Yii::$app->assetManager->publish($path).'/';
$video_explicativo = $assets_url."video_explicativo.jpg";
echo "<img id='video_explicativo' src='$video_explicativo' />";
But it doesn't work. Image file is copied successfuly from frontend/views/images/video_explicativo.jpg to frontend/web/assets/81a22c66/video_explicativo.jpg, but $assets_url is returning an array, instead of a string with the URL. So the image doesn't display.
Can you help me with this? I beg you pardon for my poor english. Thank you.