Annotation of loncom/cgi/thumbnail.gif, revision 1.1
1.1 ! www 1: #!/usr/bin/perl
! 2:
! 3: # The LearningOnline Network with CAPA
! 4: # thumbnail.gif - a CGI script that ships out the thumbnail
! 5: #
! 6: # Copyright Michigan State University Board of Trustees
! 7: #
! 8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
! 9: #
! 10: # LON-CAPA is free software; you can redistribute it and/or modify
! 11: # it under the terms of the GNU General Public License as published by
! 12: # the Free Software Foundation; either version 2 of the License, or
! 13: # (at your option) any later version.
! 14: #
! 15: # LON-CAPA is distributed in the hope that it will be useful,
! 16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
! 17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 18: # GNU General Public License for more details.
! 19: #
! 20: # You should have received a copy of the GNU General Public License
! 21: # along with LON-CAPA; if not, write to the Free Software
! 22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! 23: #
! 24: # /home/httpd/html/adm/gpl.txt
! 25: #
! 26: # http://www.lon-capa.org/
! 27: #
! 28: # Scott Harrison
! 29: # YEAR=2001
! 30: # 8/15,9/28,12/11
! 31: #
! 32: ###
! 33:
! 34: # Example usage: /cgi-bin/thumbnail.gif?url=...
! 35:
! 36: use strict;
! 37:
! 38: $|=1; # Autoflush after each print/write
! 39: foreach (split(/&/,$ENV{'QUERY_STRING'})) {
! 40: my ($name, $value) = split(/=/,$_);
! 41: $value =~ tr/+/ /;
! 42: $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
! 43: if ($name eq 'url') {
! 44: $ENV{'form.'.$name}=$value;
! 45: }
! 46: }
! 47:
! 48: # Tell the server we are sending a gif graphic
! 49: print <<END;
! 50: Content-type: image/gif
! 51:
! 52: END
! 53:
! 54: my $fn='/home/httpd/html/res/adm/pages/nothumb.gif';
! 55: open (IN,$fn);
! 56: binmode(STDOUT);
! 57: print join('',<IN>); # output image
! 58: $|=1; # be sure to flush before closing
! 59: close IN;
! 60:
! 61:
! 62:
! 63:
! 64:
! 65:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>