CodeIgniter Forums
image not displaying - 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: image not displaying (/showthread.php?tid=57719)



image not displaying - El Forum - 04-05-2013

[eluser]Unknown[/eluser]
In the views, I have a php file that displays the image.
Inside the body, I have &lt;img src="..."&gt;</img>
When I use an image link address from the internet, it's displaying the image.
But if I reference an image in the img folder, it will display a question mark(in safari browser).
Is there some configuration for file access in codeigniter?


image not displaying - El Forum - 04-05-2013

[eluser]pickupman[/eluser]
A common configuration when using Codeigniter is to have clean urls. This can present an issue for some users , and how they are used to creating links to images. Urls can be relative or absolute. A relative url is something like <img src="my-image.jpg" /> whereas an absolute url would be <img src="http://yoursite.com/my-image.jpg" /> or <img src="/my-image.jpg" />. A relative url will be from the image name being appended to the current directory in your address bar. Since CI uses clean url's, a relative path is trying to append the image path from possible a name of the controller or view folder which doesn't exists.

To check if this is your problem, first try using the full address to the image. <img src="http://yoursite.com/my-image.jpg"/>.

If you are putting your images inside of the application folder, they are being blocked from the .htaccess file located in /application folder.