From 4f6cf28106ade7c0fbb93955e53b27601b7eef24 Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Tue, 26 Feb 2008 09:30:18 +1300 Subject: [PATCH] Adding code to default to patron-blank.png if no image exists in the Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- members/patronimage.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/members/patronimage.pl b/members/patronimage.pl index 84ce9f4779..bc9b14f5c9 100755 --- a/members/patronimage.pl +++ b/members/patronimage.pl @@ -64,8 +64,15 @@ if ($dberror) { # NOTE: Never dump the contents of $imagedata->{'patronimage'} via a warn to a log or nasty # things will result... you have been warned! -print header (-type => $imagedata->{'mimetype'}, -Content_Length => length ($imagedata->{'imagefile'})), - $imagedata->{'imagefile'}; +if ($imagedata) { + print header (-type => $imagedata->{'mimetype'}, -Content_Length => length ($imagedata->{'imagefile'})), $imagedata->{'imagefile'}; + exit; +} else { + warn "No image exists for $cardnumber" if $DEBUG; + my $urlbase = url(-base => 1 -rewrite => 1); + warn "URL base: $urlbase" if $DEBUG; + print redirect (-uri => "$urlbase/intranet-tmpl/prog/img/patron-blank.png"); +} exit; -- 2.39.5