Depends on what you want it to be :-).

Here's a subroutine that will send back a GIF or JPG picture:

sub send_picture {

   # Return the verified picture back to the browser
   # Usage: &send_picture('picture')

   $picture = $_[0];

   if (-f "$picture") {

      binmode STDOUT;

      # Set correct HTTP header...
      if ($picture =~ /\.jpg/) {

         print "HTTP/1.0 200 OK\n";
         print "Content-Type: image/jpeg\n";
      }
      if ($picture =~ /\.gif/) {

         print "HTTP/1.0 200 OK\n";
         print "Content-type: image/gif\n";
      }
      ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,
      $mtime,$ctime,$blksize,$blocks) = stat("$picture");
      print "Content-length: $size\n\n";

      open (FILE, $picture) || exit;
      binmode FILE;

      while ($bytesread=read(FILE,$chunk,65536)) {

         print "$chunk";
      }
      close(FILE);
   }
}


Brian



----- Original Message -----
From: "Steve Sotis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 25, 2001 9:17 PM
Subject: Re: Serving Images


> Yes, but (and please excuse my complete and total ignorance) what exactly
is the contents of displayimage.pl?
>
>
> At 07:08 PM 1/25/01 -0400, you wrote:
> >Should work, but beware - image isn't cached by the browser (= more
> >bandwidth usage, might be problematic for busy sites).  Can't really see
any
> >way around this though.
> >
> >Was going to do something like this for a "banner" script, but decided to
> >have the script create the page which in turn had an IMG SRC=somthing.gif
> >link embedded in it.
> >
> >Brian
> >
> >----- Original Message -----
> >From: "Ron Grabowski" <[EMAIL PROTECTED]>
> >To: "Steve Sotis" <[EMAIL PROTECTED]>
> >Cc: <[EMAIL PROTECTED]>
> >Sent: Thursday, January 25, 2001 6:59 PM
> >Subject: Re: Serving Images
> >
> >
> >> What if you did someting like
> >>
> >> <IMG SRC="displayimage.pl?image=/secure/one.jpg">
> >>
> >> And let the script do its things behind the scenes. These sounds like
> >> something Randal would write a column about over at webtechniques.com
> >> _______________________________________________
> >> Perl-Win32-Web mailing list
> >> [EMAIL PROTECTED]
> >> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
> >
> >_______________________________________________
> >Perl-Win32-Web mailing list
> >[EMAIL PROTECTED]
> >http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
>
>
> Steve Sotis
> eProcessingNetwork
> http://www.eProcessingNetwork.Com
> [EMAIL PROTECTED]
> (281) 599-5954
>
> _______________________________________________
> Perl-Win32-Web mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to