Tuesday 10 March 2015

Display image from a folder in Codeigniter

(1)write  code for  "displayimage.php"  fiel & save into views folder:

<?php

$this->load->helper('directory'); //load directory helper

$dir = "uploads/"; // 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;?>"  height="200"  width="200"   alt="">
  
<?php }
         
?>




(2)write code for upload_controller.php file  & save inot controllers:


<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class  Upload_Controller extends CI_Controller

{

public function __construct()

{
parent::__construct();

$this->load->helper('url');
}

public function displayimage()

{

$this->load->view('displayimage');



}


}


?>


(3)to run  it open browser & type following code:

  "localhost/ci/index.php/upload_controller/displayimage"

55 comments:

  1. nice post bro www.gajabwap.blogspot.in

    ReplyDelete
  2. I like your awesome and briefing information's how to get lots of followers on instagram instantly and i was looking for these types of knowledge.

    ReplyDelete
  3. Great post dear. It definitely has increased my knowledge on Spark, Epilator Pain Please keep sharing similar write ups of yours.

    ReplyDelete
  4. beneficial post please if you make you way of path comfertable so you should 2019 's best corcoran boots to buy for comfrt zone.

    ReplyDelete
  5. beneficial post please if which kissanime is real you make you way of path comfertable so you should 2019 's best gogoanime corcoran boots to buy for comfrt zone.

    ReplyDelete
  6. beneficial post please if watch prison school season 2 you make you way of path comfertable so you should 2019 's best gogoanimes corcoran boots to buy for comfrt zone.

    ReplyDelete
  7. This is the really great post, I like Captain Marvel Leather Jacket I am interested in reading this post.

    ReplyDelete
  8. Nice Post. How could we use pagination while displaying image from folder in codeigniter?

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. nice information you shared with us here you may can take much info regard lifestyle food diet health etc https://styleup365.net/ to make yourself healthy and wealthy.

    ReplyDelete
  11. here you get anime movies with hd quality Buzznor

    ReplyDelete
  12. This is the really great post, I like electric power washer Leather Jacket I am interested in reading this post.

    ReplyDelete
  13. Great post dear. It definitely has increased my knowledge on animegogoio Spark, Epilator Pain Please keep sharing similar write ups of yours.

    ReplyDelete
  14. Its great to see this post. I really appreciate your work Cyberpunk 2077 Leather Jacket

    ReplyDelete
  15. its great post too see this post . I really appreciate your work.
    The Leather Makers

    ReplyDelete
  16. This blog gives us knowledge about physical education and this blog gives some key information about his coaches. So I am glad to found this types of articles. Hatts off mate you wroke a fabulous article and I www.tech5hop.com would like to thank the admin he or she did a polite job here.

    ReplyDelete
  17. welcome to you in my blog full of thril and interest i know there many more people who like harry poter and whant its novels so come to me free of coast online download and read harry potter book order

    ReplyDelete
  18. Mate, you have a endowment. A talent to write highly wonderful articles and on a very ordered basis, Social Magz I must say that this is a rare talent and you are really making full use of that talent. Good to see that

    ReplyDelete
  19. Appreciate the value! Great post again! Through with this content, you have given stand out introduction. krowd | Muqbar

    ReplyDelete
  20. This article gives the light in which we can watch the truth. This is extremely pleasant one and gives in depth data of this site. A debt of gratitude is in order for this pleasant article. caffmos

    ReplyDelete
  21. What else may I get that kind of info written in such a perfect approach? logan online

    ReplyDelete
  22. Oh I Am Tired To Found This Type Of Excellent Article.my Friend Told Me And Send Me This Blog Link..well This Blog Give Some Related Information About Fitness. I Really Inspired Your Posting..keep It Up And Update This Type Of Marvelous Information. www.rousernews.com

    ReplyDelete
  23. This is an unbelievable rousing article.
    Read More

    ReplyDelete
  24. amazon firestick channels Really satisfied with all the information I have found in this article. It gives immense knowledge

    ReplyDelete
  25. This is the first time that I visit here. I found so many exciting matters in this particular blog, One thing I would like to request you that pls keep posting such type of informative blog. WWE Shop

    ReplyDelete
  26. I appreciate this blog your blog is vert help full for me i really enjoyed this stuff dude. Mens Leather Jackets

    ReplyDelete
  27. here platform you share your article freely projectfreetv

    ReplyDelete
  28. Its not like I’m reading its like you are talking to me. misterantibully

    ReplyDelete
  29. I’m not a good reader but your articles make me think I am. You seriously have Great writing skills. 25 minute timer - TechLipz

    ReplyDelete
  30. The flow i n your writing is marvelous you can’t stop reading. avast safezone

    ReplyDelete
  31. There are lots troubles come up getting a trader, traders jobs is not sometimes they have to do under squeeze position. Bill Burr Wife - BMV

    ReplyDelete
  32. This is an unbelievable rousing article. I am fundamentally satisfied with your great work. You put truly exceptionally lodging data...Amazing Work..! SEO Service - Buy SEO Service

    ReplyDelete
  33. I always learn something new after reading your articles. Please keep writing and keep spreading the treasure of knowledge. Shareagain

    ReplyDelete
  34. This comment has been removed by the author.

    ReplyDelete
  35. Thanks for sharing such a marvelous post! I truly enjoyed while reading it. I always learn something new from your article. You are the epitome of knowledge. Keep spreading this. Informationalot

    ReplyDelete
  36. Thanks for writing a superb Blog. On this website, I always see quality depending articles. I also follow you. I want to be the best blogger like you—every time I like to read your writing stuff because I get very useful content there. You do great work.Thanks for writing this simple and interesting.Blog.
    bill burr wife and kid

    ReplyDelete
  37. Thankyou for sharing this important information. Your blog is truly exceptional in teaching coding. The Global Information - A Blog for Finance, Health, Travel Tips

    ReplyDelete
  38. Your article is such an informative article. It is glad to read such those articles. Thanks for sharing.
    Star Wars New Hope Luke Jacket

    ReplyDelete
  39. Really informative and very useful post. Thanks for sharing this blog with us. Keep it up and always keep posting such kind of information. Chronicles Santa Claus Coat

    ReplyDelete
  40. I am truly amazed by your writing skills. The articles are inspiring and very interesting to read!
    hostinglive247

    ReplyDelete
  41. Great post. Articles that have meaningful and insightful comments are more enjoyable, at least to me. It’s interesting to read what other people thought and how it relates to them or their clients, as their perspective could possibly help you in the future. Emily Bett Rickards Coat

    ReplyDelete
  42. Hy I'm Designer For Customize Leather Jackets. Please Visit Our Website. Oscars 2020 Eminem Black Faux Leather Jacket

    ReplyDelete
  43. You This article is written very well. I get a lot of assistance from your article and I will hopefully get ahead Because your writing is how good writing method of your article is different but it is easier to understand

    These easy methods can solve your problem and if you want online support help then visit - ij start canon

    ReplyDelete
  44. This is a biker jacket made for women and men with a sleek style. It has a collar followed by a side metal closure. Sebastian Stan Green Leather Jacket

    ReplyDelete
  45. HARDCORE CYCLES was started in the Greater Philadelphia area by a group of tight friends with a passion for V-Twin performance aftermarket parts.Visit our Website Thanks
    Arlen Ness MX Driver Footpag

    ReplyDelete
  46. I was thinking about how to fix skin break out regularly additionally, PISTOL LOUIS PARTRIDGE BLACK LEATHER BIKER JACKET noticed your site by google, gathered huge loads of helpful information as of now i'm a piece clear.

    ReplyDelete