| 1 | ############################################################################## | ||
| 2 | # The Faq-O-Matic is Copyright 1997 by Jon Howell, all rights reserved. # | ||
| 3 | # # | ||
| 4 | # This program is free software; you can redistribute it and/or # | ||
| 5 | # modify it under the terms of the GNU General Public License # | ||
| 6 | # as published by the Free Software Foundation; either version 2 # | ||
| 7 | # of the License, or (at your option) any later version. # | ||
| 8 | # # | ||
| 9 | # This program is distributed in the hope that it will be useful, # | ||
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | ||
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | ||
| 12 | # GNU General Public License for more details. # | ||
| 13 | # # | ||
| 14 | # You should have received a copy of the GNU General Public License # | ||
| 15 | # along with this program; if not, write to the Free Software # | ||
| 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.# | ||
| 17 | # # | ||
| 18 | # Jon Howell can be contacted at: # | ||
| 19 | # 6211 Sudikoff Lab, Dartmouth College # | ||
| 20 | # Hanover, NH 03755-3510 # | ||
| 21 | # jonh@cs.dartmouth.edu # | ||
| 22 | # # | ||
| 23 | # An electronic copy of the GPL is available at: # | ||
| 24 | # http://www.gnu.org/copyleft/gpl.html # | ||
| 25 | # # | ||
| 26 | ############################################################################## | ||
| 27 | |||
| 28 | use strict; | ||
| 29 | |||
| 30 | ### | ||
| 31 | ### img.pm | ||
| 32 | ### | ||
| 33 | ### A dynamic interface to the images in ImageData.pm. It's only | ||
| 34 | ### here in case there's just no way to get the images into the filesystem | ||
| 35 | ### and http-serve them from there. | ||
| 36 | ### | ||
| 37 | |||
| 38 | package FAQ::OMatic::img; | ||
| 39 | |||
| 40 | use FAQ::OMatic::ImageRef; | ||
| 41 | |||
| 42 | sub main { | ||
| 43 | my $cgi = FAQ::OMatic::dispatch::cgi(); | ||
| 44 | my $name = $cgi->param('name') || 'unchecked'; | ||
| 45 | |||
| 46 | my $data = FAQ::OMatic::ImageRef::getImage($name); | ||
| 47 | |||
| 48 | print FAQ::OMatic::header($cgi, | ||
| 49 | '-type'=>"image/".FAQ::OMatic::ImageRef::getType($name), | ||
| 50 | '-expires'=>24*30*3); # cache those suckers for a good season | ||
| 51 | print $data; | ||
| 52 | } | ||
| 53 | |||
| 54 | 1; |