Reputation: 14418
I am trying to show an image by doing the following:
<img class="header" src="banner.png"></img>
banner.png is located in the same folder as my .php file. Why can't it find it when I trace it in firebug?
Solution::
What happened was I copied the image via FTP, and the permission was not set to read, doing a chmod solves the issue.
Upvotes: 1
Views: 14834
Reputation: 31
perhaps its a permission thing go in terminal
sudo su
cd /Library/WebServer/Document
chmod 755 the image file name
this will probably fix it if your problem is localhost
Upvotes: 0
Reputation: 2532
Are you working from a web server (like Apache or lighttpd or Mongrel) or directly from files (you will see file:// in your browser bar)?
If your website is hosted on a web server, make sure the file permissions on the banner.png file are set to allow the web server to access them - otherwise it won't be able to serve the file. Then for all intents and purposes the file doesn't exit. Changing that depends on your host server's operating system.
Shot in the dark here for what you have - on Linux and Max OSX, you can use "chmod 664 banner.png" when in your directory. That setting should be sufficient.
If you are working from files - I think something else is off! Check the permissions anyway.
UPDATE: Turns out this was the issue :)
Upvotes: 4
Reputation: 15802
Aside from anything else, an img tag should close itself:
<img class="header" src="banner.png" />
Other potential, though unlikely, causes include:
Also, credits to animuson in comments: If this script is being included (if you don't know what that is, ignore this possibility), then the path should be relative to the including script, not the included script.
Upvotes: 5
Reputation: 78520
Only thing I see wrong is the fact that you are using a closing tag. img tags are self closing always
<img class="header" src="banner.png" />
Upvotes: 4