Images not appearing

software development


I wrote a simple app that is stored in the directory of /my_DH_user_name/

I have the images for the buttons stored in a directory under /

I can go to and see the button if I go to it by typing the address in an address bar.

However I cannot get the buttons to appear in my application.

A code snipped is :

and another is:

(the logout button takes you to the login page)

Even if I change the above to but that fails too.

It must be something simple I am overlooking as I have plenty of images other places.
Any thoughts?


Did you try clearing your browsers cache?

My website


Tried that, actually cleared the cache after I made changes to the code (I added and deleted dots and slashes and paths like a madman).

I tried different browsers, different OS, different machines. It has to be something simple that I’m missing.


Try to open the page in Internet explorer and view source code from there. Check the image path again in the source code.

Or, you may want to upload the URL link so that we can take a look.

It is really odd.

Save $97 (MAX Discount) with code: [color=#CC0000]97YES[/color] Sign Up NOW or More Codes here


It even does it on the login.php page.

Here are all the files in the directory /home/myname/ (just cut and pasted from a telnet session)
but (the directory for the buttons)

Thanks for taking a look.


There is definitely something weird going on. If you look at the headers that are sent (I use FF2.0 with the LiveHTTPHeaders extension), you will see:

GET /but/login.gif HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv: Gecko/20070725 Firefox/
Accept: image/png,/;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: PHPSESSID=j2jpq0shmuvratmk9t1i5j15b7

HTTP/1.x 403 Forbidden
Date: Thu, 06 Sep 2007 19:02:36 GMT
Server: Apache/2.0.54 (Unix) PHP/4.4.7 mod_ssl/2.0.54 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.4.2

Duplicating your code on another of my sites (also using PHP4.4.7 - and using [color=#0000CC]src=“but/login.png” value=“Submit”[/color]), I had the same results as you did; using a “.png” file instead of a “gif” works just fine.

I do not yet understand all that is at play here, but using a .png seems to get it to work.




I got a bit intrigued with your problem, and did a little research and a few tests.

It looks to me as though the problem is your “.gif” file. Did you possibly get that graphic by using “save image as” and maybe save a .png file as a “.gif”?

The reason I ask is that when I create a .gif from scratch, or substitute a “known good” .gif, and use that graphic in place of your .gif file, everything works fine.

This leads me to believe that the graphic file itself is “borken” :wink: . I don’t know why it still displays in some circumstances (may be a quirk of our browsers being “forgiving”?), but a “new” graphic worked fine for me.

Why don’t you try a different graphic (one that you know is good), and see if you have similar results?



I tried a .png and the same thing happened.

I recreated the gif file in PS and called it login2.gif. I tired that as the code was written and it failed. I can load the absolute path in any browser, and when I do so and then load the page the image is there, until I refresh the page.

I put the absolute path (with the new gif) in the code and it too fails.

I left it that way at if anyone wants to look at it.

I can’t fathom why it would not display images. I though there was an error in the code, but it seems to work when someone else hosts it it works fine.

Heck when I open it in FrontPage (it was installed on the box when it was given to me) and preview it it works fine. [ On the bright side, I finally found a use for FrontPage.]

Is there some DH thing that would prevent images from displaying?


Not that I can think of, or duplicate. :frowning:

I’m convinced it is your graphic! is the “PS” you are using stand for “PhotoShop” or PaintShop" or what?

I copied your file’s code, set up a duplicate directory structure on my DH account (same version of PHP you are using) and it works - you can check it out yourself by visiting and clicking the various “loginx.php” link(s). :wink:

Login.php and login2.php are using the same “test” .gif that I created, with the only difference being the use of the ’ value=“Submit” ’ attribute. login3.php and login4.php are using a “fixed” version of your original graphic (one .gif and one .png) that I ran through my graphics editing program. Note that all tests using your original graphic failed to display in the page though I could get it to display with the direct url as a modified .png. When I tried to display your original .gif graphic via a direct link in FF, I got a message saying the graphic file had errors. Are you doing your testing in IE?

You can see the source of each loginx.php file in your browser (view source) to see for yourself the code - and you are welcome to download/save and use the “fixed” .gif and .png file of your “login” graphic if you want. Try that, clear all your caches and such, and see what happens. :wink:



This is very strage (I used PhotoShop btw).

I copied your test.gif into my but dir and edited my code to point to the relative path to that (/but/test.gif) and that didn’t work.

Then I cut and pasted your entire line That is the code currently there. I tried MSIE, Firefox, Opera on a windows box, Opera on a Slackware box, and MSIE and Firefox on my w2k box from work. All the same results. (I did clear the cache each time)

Something similar happened to me when I installed Joomla some time ago. As I was just fooling around with it I ignored it. I just reinstalled Joomla at
and it does the same thing with images. (look at the rss feeds in the lower left corner) The alt text shows up but no images (except in MSIE which butchers that).

This is very very strange if it happens on all of my domains.


I just browsed your site again and noticed something interesting: presently displays a listing of many image files - none of which are directly viewable by my with a browser. Trying to view any of them results in an error message:

You don’t have permission to access /but/delete.gif on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."

As DreamHost uses suexec, which has CGI programs running as your user, not the webserver’s user, you must set the directories to nothing less restrictive than 755 for things to work properly. This is true even if installation instructions for scripts tell you otherwise (for instance they say to set some things to 666 or 777). Having permissions set “incorrectly” for the DH suexec environment can sometimes create the kinds of problems you are seeing.

You might want to double-check to see that your directories and scripts (.php files) are set with 755 permissions, and that all your image files are set to 644 permissions.

That is one thing that is possibly different between our configurations - I can’t tell for sure as I can’t see your permissions, but it is worth checking!.



I agree! It is (remotely) possible that there is some misconfiguration of your server that is causing this (Mime-types, maybe) but check my last response to you for another possibility - permissions issues.

Note that this should not be a problem with a Joomla! “one-click” install - did you install Joomla! yourself, or did you use the “one-click”?

I’m really curious to see what permissions you have set on the directory and the image files.



It gets even more odd.

The permissions are:

all .gif files have the same permissions

-rw-r–r-- 1 598 2007-09-06 20:21 login.gif
-rw-r–r-- 1 1228 2007-09-06 12:58 login.png
-rw-r–r-- 1 1765 2007-09-05 20:12 main.gif
-rw-r–r-- 1 1076 2007-09-06 20:21 manageareas.gif
-rw-r–r-- 1 1136 2007-09-06 20:21 manageclass.gif
-rw-r–r-- 1 1107 2007-09-06 20:21 managelevels.gif
-rw-r–r-- 1 257 2007-09-06 22:25 test.gif
(there are many more but you get the idea)

all .php files have the same permissions

-rwxr-xr-x 1 19 2007-09-06 22:11 info.php
-rwxr-xr-x 1 5173 2007-09-06 20:22 levels.php
-rwxr-xr-x 1 1531 2007-09-06 22:30 login.php
-rwxr-xr-x 1 1759 2007-09-06 20:22 main.php

( more of these too but you get the idea)

so those look OK to me.

When I go to I see the directory structure and when I click on one of those files I get the same errors. However when I click in the address bar to highlight the URL and then hit enter it displays. But if I simply refresh the page with the error message it does not.

I’ve had that problem before when I have posted a screen shot for someone remote to see, they have told me they have to do that hoop jumping to see it.

I’ve never been so perplexed in my life. Thanks for all your help by the way. I forgot to add that before.

Oh, and yes one click for Joomla.


I may be getting close to duplicating your issue!

What are the permission for the dirs and



rlparker poked me on IRC and asked me to take a look at this.

After much hair pulling and "WTF"ing, I decided to take a stab and go up one level outside of your documentroot. There, I found a .htaccess file which would cause the 403 errors you were getting (it was basically blocking access to images if there was a referrer set).

I renamed this .htaccess file to htaccess-old, refreshed the page, and voila, it works!

I left it how it is now, so your site is working. I imagine you don’t really want that .htaccess there, so I left it named htaccess-old.

argh! apache can be frustrating at times :slight_smile:


Kitchen ROCKS! :slight_smile:



I wouldn’t have seen this had you not prodded me :wink:


Actually I downloaded the gif and png files. I downloaded the html file. I tried on my pc and everything just worked fine.

I did not reply coz I could not find any solution.


Kithen super!

Save $97 (MAX Discount) with code: [color=#CC0000]97YES[/color] Sign Up NOW or More Codes here


Yep! and it was above the webroot, which makes it really hard to track down.

Some things just take an “admin” who can “poke around”. :wink:

This is the second time in a month that an .htaccess file above the webroot has turned out to be the problem; more information about how this screws things up can be found in this this previous thread



Thanks very much to everyone that helped. That was the most bizarre problem I had ever seen. At first I thought it was the code, the I was convinced the images had bad mojo, then permissions.

I was losing my mind. I really have no idea how that .htaccess file got there (and I am the only one who mucks about in there) .

However no that you mentioned it, of course it makes perfect sense.

All the signs were there too, especially the resending the URL, but not refreshing the page stuff that was going on before.

Thank you for saving me from spending the day under my desk muttering. My co-workers appreciate it more than you can possibly know.