<?php foreach($works as $work) : ?>
<?php echo Asset::img('project-icons/icon/$work->cover_img', array('class'=>'img-responsive', 'alt'=>'...')); ?>
<?php endforeach; ?>
I am using FuelPHP to build a portfolio website. PHP v5.6
This is the "works" section where images and details of a "work" are fetched from database. Using foreach loop. I want to get the "cover_img" (which is the image name), inside the Asset::img(..)
How to do this? what to put in place of $work->cover_img
?
Edit: I was able to get the result by using this:
<img src="<?php echo Uri::base(false); ?>/assets/img/project-icons/icon/<?php echo $work->cover_url; ?>" class="img-responsive" alt="..." />
Can this be achieved by using Asset::img() instead of Uri::base()?
Can't you just do:
<?php
echo Asset::img('project-icons/icon/'.$work->cover_img, array('class'=>'img-responsive', 'alt'=>'...'));
?>
...?