SitePoint Sponsor

User Tag List

Results 1 to 14 of 14

Thread: Images not seen

  1. #1
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Images not seen

    hi guys...

    am running PHP on Apache, on an office intranet. When someone types in my machine's IP and the filename, they get to see the file, but all the pics are missing.

    My pics in the PHP file have the typical IMG tag:

    HTML Code:
    <IMG ALIGN="left" SRC="C:\laptop.gif">
    Any idea on how I can get the pics to be displayed when accessed? I realised since it's on my C:\ drive, there may be problems...

    Thanks!

  2. #2
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I might be missing the point, but instead of putting full file paths in, try putting relative ones to the file in.

    /laptop.gif
    this should look for laptop.gif in the root directory,

    ./laptop.gif
    this should look for laptop.gif in the current directory, and is basically the same as
    laptop.gif

    Give it a try
    Oh no! the coots are eating my nodes!

  3. #3
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi Timnz...

    Nope, that didn't work out. All I got was the red x in the box.. the typical no picture found error.... I changed the file paths so it read:

    <IMG ALIGN="left" SRC="/laptop.gif">

    and also

    <IMG ALIGN="left" SRC="./laptop.gif">

    reversing the slashes also didn't work

    Any other ideas?

  4. #4
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is the picture actually there?

    Also, when they are accessing it, are they accessing it through the network like they would access any other file, or is it going through Apache? Should be going through Apache, but just ruling out the possibilities here.
    Oh no! the coots are eating my nodes!

  5. #5
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Errr... okay... let me rephrase it from the top

    The picture, laptop.gif resides in my C:\ drive. I am using Apache on my machine, which means I've turned my terminal into a server.

    So, when I type "localhost/thisphpfile.php" in IE, the files turn up right, work right, and pictures are A OK.

    Problem turns up when I go to another terminal on the n/w, hit in my IP add like "xxx.xxx.xx.xxx/thisphpfile.php". Now, doing this makes my programs run fine, but all graphics and CSS templates are missing (not displayed).

    When I used your suggestion, even on localhost, I couldn't get the pictures.... this assuming I followed your instructions, with the picture located in the root C:\ drive.

    And I don't quite understand what you said by "....or is it going through Apache? Should be going through Apache, but just ruling out the possibilities here." Urmm.. it goes thru Apache? The IMG SRC link is located in the PHP file, so yes, it gets parsed as well.... I think...

  6. #6
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, ok, I think I can kind of see the problem, I bet is that the pictures will show up, if you copy laptop.gif to the htdocs directory of Apache, or wherever you store your Apache files, and then use the ./ and / as I mentioned above.

    Since it isn't on their C:\, you need to place it in the htdocs folder or whatever, so that it is "shared".
    Oh no! the coots are eating my nodes!

  7. #7
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    Texas
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah, thats the problem. Any files you use, including images, have to be in the htdocs if you want people to be able to view them.
    Mark -
    www.magicscripts.net

  8. #8
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    awwwright! thanks guys.. yep.. copying images to htdocs worked. strange that thought of this earlier, then I went to bed and forgot all about it....

    One other question: my PHP page also uses CSS stylsheets, where the .CSS file is in C:\. Now, there's a background image that appears on every page, which can't be seen by clients, like my image problem. And that IMG link reference is in the CSS file. Question: Do I...

    1) Copy the whole .CSS file to htdocs as well?

    or...

    2) Change the url("C:\protonicbg.bmp") line in the CSS file to ./protonicbg.bmp as well?

    Note on #2: The CSS file.. does it get parsed? Am wondering if ./protonicbg.bmp will work..

    am off to experiment, but would love to hear from you guys!

  9. #9
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok guys...

    about the images not being seen.. since dumped them into /htdocs and ran the PHP file, no problems viewing them on localhost. problem occurs when clients access "myIP/filename.php" thru IE.. the text and all docs. run fine.. but all graphics don't work!

    Strange... they're all in htdocs, and I changed to link HTML IMG SRC.... link to them to what Timnz mentioned...

    Any ideas?

  10. #10
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tried a few more tricks.. nope.. still no image....

  11. #11
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why don't you post the relevant code so we can see what is exactly breaking it.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  12. #12
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sure thing...

    here's what's in my header file:


    <LINK REL="stylesheet" HREF="./pdc_emp.css" TYPE="text/css">

    the CSS file is in /htdocs, and the content of the CSS file is:

    BODY {background:#ffffff url("C:\Program Files\Apache Group\Apache\htdocs\focusnight\protonicbg.bmp") no-repeat fixed; font:10pt Arial,sans-serif}

    The protonicbg.bmp file remains static when the user scrolls down... this is an applied style for all webpages.

    i get to see the styles in localhost, but clients over the network clicking thru my "IP/filename.php" add. in IE don't.... not even the background.

    Does this CSS file get parsed too?

  13. #13
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, but url is a url not a system path. You need to use either

    BODY {background:#ffffff url("focusnight/protonicbg.bmp") no-repeat fixed; font:10pt Arial,sans-serif}

    or

    BODY {background:#ffffff url("http://ipnumber/focusnight/protonicbg.bmp") no-repeat fixed; font:10pt Arial,sans-serif}
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  14. #14
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yea, you can never use a path like: C:\myfiles\pic.gif in ANY kind of tag etc.

    if your going to just run a file off of your disk, and not something that'd be visible on the web, use this:
    Code:
    <img src="file:///C:/myfiles/pic.gif">
    that'll be viewable from YOUR computer only.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •