Reputation: 91
So this is the code of the view. For some reason the imagine does not show. Var_dumping $oProduct->img_path returns (I modified these paths for testing purposes , since I'm working with more db entries):
'W:/wamp/www/repos/adicris/imgs/products/logo.jpg' (one element)
'imgs/products/logo.jpg' (some other element)
'/imgs/products/logo.jpg' (some other element)
adicris is the folder containing the entire project.
So as you can see I tried giving it the full path and the relative path , with no success.
PS: The picture name is spelled correctly , it does allow for jpg and it is in the right folder.
<?php foreach ($aProducts->result() as $oProduct): ?>
<tr>
<td><?=$oProduct->pid?></td>
<td><?=$oProduct->name?></td>
<td><img scr=<?=$oProduct->img_path?>></td>
<td><?=$oProduct->price?></td>
<td><?=$oProduct->description?></td>
<td><?=$oProduct->type_name?></td>
</tr>
<?php endforeach ?>
I also tried this in the img line:
<td><img scr="<?=base_url()?><?=$oProduct->img_path?>></td>
Fails for all entries regardless of img_path form.
Upvotes: 0
Views: 145
Reputation: 32127
<td><img src="<?=base_url()?><?=$oProduct->img_path?>"></td>
^^^ Not scr.
Don't forget the quotes for your tag attributes either. Whilst it works in most browsers, it's not valid.
Upvotes: 2