Welcome Guest, Not a member yet? Register   Sign In
Calling img src and alt from database
#5

(10-16-2017, 10:34 AM)PaulD Wrote: You seem to be doing it correctly, but it could be simplified.

PHP Code:
<img src="<?php echo base_url($accessories_item['imagesrc']); ?>" alt="<?php echo $accessories_item['imageAlt']; ?>" /> 

Although you may have already stored a / at the beginning of the file name in the db that CI might insert, giving you two // after the base url. Not sure if it gets trimmed out automatically or not.

Paul.

Hi Paul,

Apologies for the delay in my reply!

Thanks for taking a look. I'm all for taking a simplified approach.

I did not have the / in the DB and have left that as is. I've swapped my snippet for your more efficient sampleĀ and it works as expected.

Thank you for that - I can press on with my other views now!

Best regards,

Alan
Reply


Messages In This Thread
Calling img src and alt from database - by alann - 10-16-2017, 02:23 AM
RE: Calling img src and alt from database - by alann - 10-23-2017, 07:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB