How can I show images from assets in list view on a module?
In my logos model, I insert an image name into the database.
How can I saw each image in the module list view?
I guess I should do something in the list_items function but I don't know what.
Thank you.
Comments
function list_items($limit = NULL, $offset = NULL, $col = 'nav_key', $order = 'desc') { $data = parent::list_items($limit, $offset, $col, $order); foreach($data as $key => $value) { $data[$key]['image'] = '<img src="'.img_path($value['image']).'" alt="" />'; } return $data; }
I prefer
// PHP's original file exist check function
file_exists(img_path('product/' . $this->thumb_name($data[$key]['photo'])))
to
//just check image name field in the database, not the image file
!empty($data[$key]['photo'])
yes, I'm lazyyyyyyyy
Personally I'd check the database value first before taking the hit to check the disk. My 2 cents.