Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

CGI Image Pusher

by pschoonveld (Pilgrim)
on Feb 07, 2002 at 16:26 UTC ( #143908=perlcraft: print w/replies, xml ) Need Help??

   1: #!/usr/bin/perl
   2: # CGI Animated GIF Pusher
   3: 
   4: # Harkening back to the days before GIF89, I needed one of these
   5: # today. So, I wrote one and it works. But, as it turns out, not
   6: # with the joy that is IE. Netscape, no problem.
   7: 
   8: print "Content-type: multipart/x-mixed;boundary=myboundary\n\n";
   9: print "myboundary\n";
  10: $| = 1;
  11: @images = ('green.gif','blue.gif','red.gif');
  12: foreach $image (@images) {
  13: 	print "Content-Type: image/gif\n\n";
  14: 	open IMAGE,"<$image" or die "bad image, $image";
  15: 	print <IMAGE>;
  16: 	close IMAGE;
  17: 	print "\nmyboundary\n";
  18: 	sleep 2;
  19: }

Replies are listed 'Best First'.
Re: CGI Image Pusher
by merlyn (Sage) on Feb 07, 2002 at 17:06 UTC
Re: CGI Image Pusher
by Anonymous Monk on Dec 25, 2011 at 02:40 UTC

    For good measure, binmode STDOUT and IMAGE

Re: CGI Image Pusher
by Ryszard (Priest) on Feb 14, 2002 at 04:56 UTC
    Whoops! might want to add the FS response: <code>open IMAGE,"<$image" or die "bad image, ".$image.": ".$!;</code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlcraft [id://143908]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2023-03-27 13:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (65 votes). Check out past polls.

    Notices?