MT 1717 : Opac descriptions for authorised values
[koha.git] / opac / sco / sco-patron-image.pl
1 #!/usr/bin/perl
2 #
3 # Copyright 2009 LibLime
4 #
5 # This file is part of Koha.
6 #
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
11 #
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA  02111-1307 USA
19
20 use strict;
21 use warnings;
22 use C4::Service;
23 use C4::Members;
24
25 my ($query, $response) = C4::Service->init(circulate => 'circulate_remaining_permissions');
26 my ($cardnumber) = C4::Service->require_params('cardnumber');
27
28 my ($imagedata, $dberror) = GetPatronImage($cardnumber);
29
30 if ($dberror) {
31     print $query->header(status => '500 internal error');
32 }
33
34 if ($imagedata) {
35     print $query->header(-type => $imagedata->{'mimetype'}, 
36                          -Content_Length => length ($imagedata->{'imagefile'})), 
37           $imagedata->{'imagefile'};
38 } else {
39     print $query->header(status => '404 patron image not found');
40 }