francis
francis

Reputation: 307

This path for a picture doesn't work

I'm building graphs using pChart in PHP. The case is that I have my picture in the right folder, I know it because if I put that path in the browser I can see my picture, but in the template, it doesn't show up. Firebug shows "failed to load the given URI".

<img src="/home/user1/mysite/Admin/Template/mx_graphs/example13.png">

The picture has all the rw permissions given, and the folder.

Upvotes: 0

Views: 47

Answers (2)

Remember the statement:

<img src="/home/user1/mysite/Admin/Template/mx_graphs/example13.png">

Will run on the client side, so if you run this on the very computer where the picture is stored, it should work fine, but if you try to open it from another computer it will not work. Try to use relative path (http://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/), and try to keep the website resources into the website root folder, so that even when you host the site the image be copied over and will still be accessible..

Upvotes: 1

Quentin
Quentin

Reputation: 944528

You appear to be using a UNIX file path instead of a relative URI. Your web server is unlikely to be configured to have the DocumentRoot be / (and it would be very silly to do so).

Construct a URI relative either to the HTML document or to the DocumentRoot of your server.

The latter will probably be /Admin/Template/mx_graphs/example13.png

Upvotes: 3

Related Questions