Results 1 to 8 of 8

Thread: Cannot see image

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Location
    London, England
    Posts
    213

    Cannot see image

    I am using the following simple cgi script to generate a html page but I cannot see the image. I have a images directory in my cgi-bin folder and a file called arrow.gif but it doesn't show up on the page. Can someone tell me if the cgi looks ok ?


    #!/usr/bin/perl

    print "Content-type:text/html\n\n";
    print <<EndHTML
    <html><head><title>Test!</title></head>
    <body>
    <table border=1>
    <tr>
    <td><img src=\"images/arrow.gif\"></td>
    </tr>
    </table>
    </body>
    </html>
    EndHTML

  2. #2
    ><img src=\"images/arrow.gif\">

    Shouldn't that be <img src="/images/arrow.gif">?

  3. #3
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Check the source of the generated HTML page. I'm not sure if you need to escape the quotes in a here document.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  4. #4
    Fanatic Member chrismitchell's Avatar
    Join Date
    Jan 2001
    Location
    With Hobbes in New Zealand
    Posts
    568
    It seems to me that the bold \ should be / instead.

    #!/usr/bin/perl

    print "Content-type:text/html\n\n";
    print <<EndHTML
    <html><head><title>Test!</title></head>
    <body>
    <table border=1>
    <tr>
    <td><img src=\"images/arrow.gif\"></td>
    </tr>
    </table>
    </body>
    </html>
    EndHTML

    If they should be there at all?

  5. #5
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    i don't think you even need them

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  6. #6
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    Code:
    #!/usr/bin/perl 
    
    print "Content-type:text/html\n\n"; 
    print <<EndHTML 
    <html><head><title>Test!</title></head> 
    <body> 
    <table border=1> 
    <tr> 
    <td><img src="/cgi-bin/images/arrow.gif"></td> 
    </tr> 
    </table> 
    </body> 
    </html> 
    EndHTML
    you dont need to escape your qoutes you simplty need to put the correct path to you gif.

  7. #7
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    by the way if i where you i'd keep my images in the html directory!

    If you created the images directory in the html directory eg. html/images/arrow.gif

    you would access it like this /images/arrow.gif


  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Location
    London, England
    Posts
    213
    That was it!

    I had the images in the cgi-bin directory, I didn't realise this wasn't allowed. It all seems to work fine now.

    Many thanks.

Posting Permissions

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



Click Here to Expand Forum to Full Width