country_dev
country_dev

Reputation: 605

apache not showing images

Just recently I have been unable to view new images through localhost on my mac(OS X 10.9.5). I'm setting a background image for a webpage through css. The webpage works and displays the background image for photos I downloaded a week ago, but when I try and update the background photo to a newly downloaded jpg (in the same dir) and view through localhost, the picture will not show up.

I know my code and file path is correct because it works with older photos in the same dir. When I view the page through my file system file:/// as opposed to localhost, it works fine and when I upload my files and images to my server everything works fine. I also have r/w access to all folders. For some reason, I simply cannot view newly downloaded images through localhost. Not sure if this is relevant but I recently installed 2 software updates:

 1) Command line tools (OS X 10.9) version 6.0 and 2) OS X Update Combined version 10.9.5.

Any ideas on how to fix this?

Code:

/* Works fine */

background-image: url("img/OLD_PIC.jpg");

/* Does not work when viewing through localhost, but does work when viewing through the filesystem and my server */

background-image: url("img/NEW_PIC.jpg");

Upvotes: 1

Views: 21761

Answers (2)

Sudip Das
Sudip Das

Reputation: 1208

Try to change the permission of this file by using this command:

sudo chmod -R a+rw /var

Upvotes: 4

c0utinh0
c0utinh0

Reputation: 179

1) Check the permissions of the new images ( If works -> chmod 777 foldername ).

2) Case 1 dont work - Try:

   background-image: url("/img/OLD_PIC.jpg");

or

   background-image: url("./img/OLD_PIC.jpg");

or

   background-image: url("../img/OLD_PIC.jpg");

One of them should work..

Note: You will probably have to change it back when you deploy to the server..

Upvotes: 1

Related Questions