Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Posts
    1

    Question Unanswered: insert image using perl script

    hi

    i have problem inserting image using perl script

    my code look sth like this:

    #!/usr/bin/perl

    use CGI;

    print "content-type:text/html\n\n";

    print <<start;
    <html>
    <body>
    start

    print <<image;
    <img src="m1.gif">
    image

    print <<end;
    </body>
    </html>
    end

    it did not display anything when i run the script but the same gif image work perfectly fine on a html script

    pls advice

    thanks

  2. #2
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    167
    Is the image really in the same folder like your cgi-script??
    Is the source of the html-result correct?

    something that isn't related to your problem:
    you use the cgi-module (use CGI; ) so you should use its methods. In that code you posted the use CGI; is for nothing. I would recommend to use cgi's methods:
    Code:
    #!/usr/bin/perl
    
    use CGI;
    use strict; # to avoid misspellings
    use CGI::Carp qw(fatalsToBrowser); # to get the error message in the browser
    
    my $cgi = CGI->new();
    
    print $cgi->header(-type => 'text/html'); # replaces your print "Content-type..."
    print $cgi->start_html(-title => 'My images page'); # replaces you HERE-document printing the html- and body-tag
    print $cgi->img({src="m1.gif"});
    print $cgi->end_html();
    board.perl-community.de - The German Perl-Community

Posting Permissions

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