Image presentation via Perl script

Discussion in 'HTML' started by Ed Jay, Oct 31, 2005.

  1. Ed Jay

    Ed Jay Guest

    I'm using a Perl script to generate html pages. I want to use images in
    the html page. The fundamental code I use to display an image is:

    print "<p><img src=\"http://www.my-site.com/image.gif\" border=1
    width=\"53\" height=\"32\" alt=\"logo\">\n";

    The image doesn't display.

    I have the same problem importing linked external style sheets and
    external javascripts.

    --
    Ed Jay (remove M to respond by email)
     
    Ed Jay, Oct 31, 2005
    #1
    1. Advertising

  2. Ed Jay wrote:

    > I'm using a Perl script to generate html pages. I want to use images in
    > the html page. The fundamental code I use to display an image is:
    >
    > print "<p><img src=\"http://www.my-site.com/image.gif\" border=1
    > width=\"53\" height=\"32\" alt=\"logo\">\n";
    >
    > The image doesn't display.
    >
    > I have the same problem importing linked external style sheets and
    > external javascripts.
    >

    Best use CGI.pm Then your code would be... I formatted it so your can
    see the parts without the NG wordwrap confusing things

    use "CGI";

    print p(
    img(
    {
    -href=>'http://www.my-site.com/image.gif',
    -border=>1,
    -width=>53,
    -height=>32,
    -alt=>'logo'
    }
    )
    );

    if your want it all 'prettified' with CR's and TAB's then

    use CGI::pretty;

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Oct 31, 2005
    #2
    1. Advertising

  3. Ed Jay

    mbstevens Guest

    Ed Jay wrote:
    > I'm using a Perl script to generate html pages. I want to use images in
    > the html page. The fundamental code I use to display an image is:
    >
    > print "<p><img src=\"http://www.my-site.com/image.gif\" border=1
    > width=\"53\" height=\"32\" alt=\"logo\">\n";
    >
    > The image doesn't display.
    >
    > I have the same problem importing linked external style sheets and
    > external javascripts.
    >

    http://www.mbstevens.com/howtothumb/
    ....toward the bottom of the article is a Perl script to display an
    image, with a lot of explanation. I suggest you read the whole article
    to understand why some of the things were done.

    You should be able to use external stylesheets and javascripts. You're
    addressing them wrong, most probably. Remember that the address is
    relative to the place the script executes, not the base address of your
    website.
     
    mbstevens, Nov 1, 2005
    #3
  4. Ed Jay

    Ed Jay Guest

    mbstevens <> wrote:

    >Ed Jay wrote:
    >> I'm using a Perl script to generate html pages. I want to use images in
    >> the html page. The fundamental code I use to display an image is:
    >>
    >> print "<p><img src=\"http://www.my-site.com/image.gif\" border=1
    >> width=\"53\" height=\"32\" alt=\"logo\">\n";
    >>
    >> The image doesn't display.
    >>
    >> I have the same problem importing linked external style sheets and
    >> external javascripts.
    >>

    >http://www.mbstevens.com/howtothumb/
    >...toward the bottom of the article is a Perl script to display an
    >image, with a lot of explanation. I suggest you read the whole article
    >to understand why some of the things were done.
    >
    >You should be able to use external stylesheets and javascripts. You're
    >addressing them wrong, most probably. Remember that the address is
    >relative to the place the script executes, not the base address of your
    >website.
    >

    I understand that. That's why I tried, unsuccessfully, to use an absolute
    address.

    --
    Ed Jay (remove M to respond by email)
     
    Ed Jay, Nov 1, 2005
    #4
  5. Ed Jay

    Ed Jay Guest

    "Jonathan N. Little" <> wrote:

    >Ed Jay wrote:
    >
    >> I'm using a Perl script to generate html pages. I want to use images in
    >> the html page. The fundamental code I use to display an image is:
    >>
    >> print "<p><img src=\"http://www.my-site.com/image.gif\" border=1
    >> width=\"53\" height=\"32\" alt=\"logo\">\n";
    >>
    >> The image doesn't display.
    >>
    >> I have the same problem importing linked external style sheets and
    >> external javascripts.
    >>

    >Best use CGI.pm Then your code would be... I formatted it so your can
    >see the parts without the NG wordwrap confusing things
    >
    >use "CGI";
    >
    >print p(
    > img(
    > {
    > -href=>'http://www.my-site.com/image.gif',
    > -border=>1,
    > -width=>53,
    > -height=>32,
    > -alt=>'logo'
    > }
    > )
    >);
    >
    >if your want it all 'prettified' with CR's and TAB's then
    >
    >use CGI::pretty;


    Thanks. You introduced me to the world of Perl modules. I had no idea...

    --
    Ed Jay (remove M to respond by email)
     
    Ed Jay, Nov 1, 2005
    #5
  6. Ed Jay

    Toby Inkster Guest

    Ed Jay wrote:

    > print "<p><img src=\"http://www.my-site.com/image.gif\" border=1
    > width=\"53\" height=\"32\" alt=\"logo\">\n";
    >
    > The image doesn't display.


    URL?

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Nov 1, 2005
    #6
  7. Ed Jay

    mbstevens Guest

    Toby Inkster wrote:
    > Ed Jay wrote:
    >
    >
    >>print "<p><img src=\"http://www.my-site.com/image.gif\" border=1
    >>width=\"53\" height=\"32\" alt=\"logo\">\n";
    >>
    >>The image doesn't display.

    >
    >
    > URL?
    >

    To sys op:
    Yes, post the actual site and image locations. And, assuming the whole
    script is in a place we don't have read access, post it too (possibly
    minus your de-tainting code, if you don't want to make that public.)
     
    mbstevens, Nov 1, 2005
    #7
  8. Ed Jay wrote:

    > "Jonathan N. Little" <> wrote:
    >
    >
    >>Ed Jay wrote:
    >>
    >>
    >>>I'm using a Perl script to generate html pages. I want to use images in
    >>>the html page. The fundamental code I use to display an image is:
    >>>
    >>>print "<p><img src=\"http://www.my-site.com/image.gif\" border=1
    >>>width=\"53\" height=\"32\" alt=\"logo\">\n";
    >>>
    >>>The image doesn't display.
    >>>
    >>>I have the same problem importing linked external style sheets and
    >>>external javascripts.
    >>>

    >>
    >>Best use CGI.pm Then your code would be... I formatted it so your can
    >>see the parts without the NG wordwrap confusing things
    >>
    >>use "CGI";
    >>
    >>print p(
    >> img(
    >> {
    >> -href=>'http://www.my-site.com/image.gif',
    >> -border=>1,
    >> -width=>53,
    >> -height=>32,
    >> -alt=>'logo'
    >> }
    >> )
    >>);
    >>
    >>if your want it all 'prettified' with CR's and TAB's then
    >>
    >>use CGI::pretty;

    >
    >
    > Thanks. You introduced me to the world of Perl modules. I had no idea...
    >

    Beats the crap out of all that quote escaping and with the CGI.pm your
    are less like to make an HTML (actually XHTML 1.0 Transitional) syntax
    error. Can also save you a lot of coding...

    my @list=qw(one two three four five six);
    print ul(li(\@list));

    Just imagine:

    print p(\@paragraphs);

    Also another tip, lookup functions q(), qq() and qw() that can be your
    friends ;-)

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Nov 1, 2005
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wet Basement
    Replies:
    1
    Views:
    2,590
    BobMonk
    Jul 15, 2003
  2. dpackwood
    Replies:
    3
    Views:
    1,862
  3. Mike Stok
    Replies:
    1
    Views:
    129
    Hal Fulton
    Sep 29, 2003
  4. pj
    Replies:
    3
    Views:
    321
  5. Ali Shirvani

    Perl Presentation

    Ali Shirvani, Nov 4, 2008, in forum: Perl Misc
    Replies:
    9
    Views:
    233
    cartercc
    Dec 1, 2008
Loading...

Share This Page