X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FImages.pm;h=8afc8fa294b763debcdf1387811217e77ff19bbb;hb=32c5ef613d8805304c1b7f97e597116226b7bbe8;hp=209cde05c47aabad6bd7ccce37fcf0d350fb8c64;hpb=28646dd55007003300b8c76262c25ab96e04871e;p=koha_gimpoz diff --git a/C4/Images.pm b/C4/Images.pm index 209cde05c4..8afc8fa294 100644 --- a/C4/Images.pm +++ b/C4/Images.pm @@ -25,7 +25,7 @@ use 5.010; use C4::Context; use GD; -use vars qw($debug $VERSION @ISA @EXPORT); +use vars qw($debug $noimage $VERSION @ISA @EXPORT); BEGIN { @@ -40,6 +40,11 @@ BEGIN { &DelImage ); $debug = $ENV{KOHA_DEBUG} || $ENV{DEBUG} || 0; + + $noimage = pack( "H*", + '47494638396101000100800000FFFFFF' + . '00000021F90401000000002C00000000' + . '010001000002024401003B' ); } =head2 PutImage @@ -101,13 +106,14 @@ sub RetrieveImage { my $sth = $dbh->prepare($query); $sth->execute($imagenumber); my $imagedata = $sth->fetchrow_hashref; - if ( $sth->err ) { - warn "Database error!"; - return undef; + if ( !$imagedata ) { + $imagedata->{'thumbnail'} = $noimage; + $imagedata->{'imagefile'} = $noimage; } - else { - return $imagedata; + if ( $sth->err ) { + warn "Database error!" if $debug; } + return $imagedata; } =head2 ListImagesForBiblio @@ -192,4 +198,17 @@ sub _scale_image { } } +=head2 NoImage + + C4::Images->NoImage; + +Returns the gif to be used when there is no image matching the request, and +its mimetype (image/gif). + +=cut + +sub NoImage { + return $noimage, 'image/gif'; +} + 1;