Display image from a directory when fetch data from database in Codeigniter framework, echo the image value in the image tag. if you fetch data from database using loop or directly access Model, so follow the example, it will be helpful for you.
<?php foreach($user_details as $val) { ?> <img src="assets/images/<?php echo $att->user_file; ?>" alt="User Image" class="img"> <?php } ?>
Or try it
<?php $data=$this->Model->UserDetails($u_id); ?> <img src="<?php echo base_url();?>assets/images/<?php echo $data[0]->user_file; ?>"> ?>
Question and answer is powered by AnsPress.io