How To Display Images From Folder Using Codeigniter?
If you need to display images from folder/directory in the CodeIgniter, then the Directory Helper is what you looking for. The Directory Helper file contains functions that assist in working with directories.
<?php $this->load->helper('directory'); //load directory helper $dir = "uploads/images/"; // Your Path to folder $map = directory_map($dir); /* This function reads the directory path specified in the first parameter and builds an array representation of it and all its contained files. */ foreach ($map as $k) {?> <img src="<?php echo base_url($dir)."/".$k;?>" alt=""> <?php } ?>Result: You will get all the images from the folder.
nice
ReplyDeletethanks for the code
ReplyDeletehi thanks for code
ReplyDeletei want to ask how to display label on image in codeignater
Thanks for the code,
ReplyDeletejust a quick question, where do you put the code using te MVC model. does it go in te views directory?
what if the folder has subfolder and subfolder how to show it?
ReplyDeletemany thanks
udin