Not able to display images - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Not able to display images (/showthread.php?tid=23309) Pages:
1
2
|
Not able to display images - El Forum - 10-06-2009 [eluser]shinokada[/eluser] I am using XAMPP and created a directroy htdocs/codeigniter_shopping. Inside that directroy I have an image directory same level as system directory. htdocs/codeigniter_shopping/images htdocs/codeigniter_shopping/system I have .htaccess as follows. Code: RewriteEngine on I have stored paths to images in database. /images/dummy-thumb.jpg However it does not display any image. I am able to see an image in the following URL. http://127.0.0.1/codeigniter_shopping/images/dummy-thumb.jpg So I tried ../images/dummy-thumb.jpg, images/dummy-thumb.jpg etc but none of them worked. I am hoping if someone can give me ideas how to store the path to image. Or do I need to change any .htaccess or not. Thanks in advance. Not able to display images - El Forum - 10-06-2009 [eluser]jedd[/eluser] Quote:However it does not display any image. Why not? As in - when you look at your page source in your browser, can you determine if the pathing is wrong, or if the tag is wrong, or if .. (etc - you get the idea). You could use something like this: Code: $img_array = array ("src"=> "/codeigniter_shopping/images/dummy-thumb.jpg", "width" => "180px", "border"=>"0", "alt"=>"some text"); Not able to display images - El Forum - 10-06-2009 [eluser]Colin Williams[/eluser] How is it that 60% - 70% of "CodeIgniter problems" people experience is something as simple as resolving paths. Take a step back people. Learn the fundamentals. Not able to display images - El Forum - 10-06-2009 [eluser]Zack Kitzmiller[/eluser] [quote author="Colin Williams" date="1254888549"]How is it that 60% - 70% of "CodeIgniter problems" people experience is something as simple as resolving paths. Take a step back people. Learn the fundamentals.[/quote] *clap* *clap* Show us the code the CI is outputting to the browser. Then maybe we can help you. Not able to display images - El Forum - 10-06-2009 [eluser]shinokada[/eluser] When I see http://127.0.0.1/codeigniter_shopping/, it shows images by using the image path images/dummy-thumb.jpg. However when I visit http://127.0.0.1/codeigniter_shopping/welcome/index or http://127.0.0.1/codeigniter_shopping/welcome/product/1 no images will shown. The links are working. It seems that I have to add http://127.0.0.1/codeigniter_shopping/images/dummy-thumb.jpg to show images. Code: <div class='productlisting'><img src='images/dummy-thumb.jpg' border='0' class='thumbnail'/> Not able to display images - El Forum - 10-07-2009 [eluser]Colin Williams[/eluser] http://webdesign.about.com/od/beginningtutorials/a/aa040502a.htm Not able to display images - El Forum - 10-07-2009 [eluser]InsiteFX[/eluser] Code: site_url() Enjoy InsiteFX Not able to display images - El Forum - 10-07-2009 [eluser]shinokada[/eluser] Thanks to InsiteFX for a constructive reply. I thought the same thing and I experimented to find out all the path and the below is the results. The siteurl() gives with index.php at the end, so I will test it with baseurl. Or I will define the path to images folder in config file to use it. Interesting thing is that CI shows BASEPATH as C:\xampp\htdocs\ci_day6/system/ in XAMPP. This means BASEPATH in windows will not work. I suggest to check index.php. Code: Basepath: C:\xampp\htdocs\ci_day6/system/ Not able to display images - El Forum - 10-07-2009 [eluser]InsiteFX[/eluser] You can fix that problem by using this code, I did not write this several other users on the forum here wrote it. Code: Place in application/config/constants.php I have modified it to use more constans. Enjoy InsiteFX Not able to display images - El Forum - 10-15-2009 [eluser]shinokada[/eluser] I added the following in the head. Code: ... Then all the links work. |