Forum Moderators: coopster

Message Too Old, No Replies

Locating images when using PHP

         

hexdj

7:04 pm on Aug 11, 2005 (gmt 0)

10+ Year Member



I am using WAMP 5 and Dreamweaver but when I try my php files, which load their own CSS files it seems that they only find images withing their same folder, something like images\logo.gif won't be procesed or found, and also seems like PHP doesn't work with png files, or is it somethign I am doing wrong?

ergophobe

7:29 pm on Aug 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Unless you are creating images using GD, PHP has no idea what type of images you are using and doesn't care. Remember, it's just sending a text link that gives the browser a path to the image. PHP has nothing to do with displaying that image.

As for not finding images, when you use an image for CSS, the path is relative to the CSS file. I find it's usually simplest to put a background image in the same directory as the CSS file, but otherwise, you'll need to resolve the path.

I'm not sure off hand if you can use absolute paths that resolve from root, but

url:image/img.png

would be
site_root/css/image/img.png

as far as I know. I haven't done it lately, though, so I could well be wrong.