Not able to display images |
[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/im...-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.
[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");
[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.
[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.
[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/im...-thumb.jpg to show images. Code: <div class='productlisting'><img src='images/dummy-thumb.jpg' border='0' class='thumbnail'/>
[eluser]Colin Williams[/eluser]
http://webdesign.about.com/od/beginningt...40502a.htm
[eluser]InsiteFX[/eluser]
Code: site_url() Enjoy InsiteFX
[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/
[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
[eluser]shinokada[/eluser]
I added the following in the head. Code: ... Then all the links work. |
Welcome Guest, Not a member yet? Register Sign In |