I am trying to display an image in my script. The problem is that the script can't find the image. I've tried the following codes:
print "<IMG SRC=$courselocation/images/$value>"; print "<IMG SRC=\"$courselocation/images/$value\">"; print "<IMG SRC=/$courselocation/images/$value>"; print img(-name=>'image', -src=>'$courselocation/images/$value');
and others. (I don't get any error messages or log errors so if I've mistyped anything here its a local error here) I have printed out the variables and they appear to be fine. $courselocation prints as ist001 and $value prints as newlogotr.gif. My root directory is
novonyx/suitspot/docs/perlroot. The courselocation is a subdirectory of this. I derived $courselocation from doing the following:
$courselocation = substr($file, 0, 6); where $file = ist001/quiz1.txt.
$value is read from a text file which looks like this: i1:newlogotr.gif~
I've even hardcoded the location in the script like this:
print "<IMG SRC=novonyx/suitspot/docs/perlroot/ist001/images/newlogotr +.gif>"; print "<IMG SRC=/novonyx/suitspot/docs/perlroot/ist001/images/newlogot +r.gif>"; print "<IMG SRC=\"novonyx/suitspot/docs/perlroot/ist001/images/newlogo +tr.gif\">";
In every case the little square box appears where the image is supposed to be, but no image. I've checked and double checked spelling, syntax, etc. I tried it at home using:
<img src=$value>
where $value = images/newlogotr.gif and it worked fine. At work I'm using perl 5.? but its not 5.6 which is what I'm using at home. I didn't know if 5.6 handled images differently or not. I suspect the problem is with my server. I guess what I'm asking for is any other troubleshooting ideas you might be able to provide. I've run out of ideas.
Many thanks. Chris

In reply to displaying an image by chriso

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.