X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FImages.pm;h=8b17f1cd2fe310f15082e84dd65d874a762c4359;hb=1e8423167ec7bcffe9851d237230c27cd2f32a2c;hp=209cde05c47aabad6bd7ccce37fcf0d350fb8c64;hpb=bd28b8d6c3ab15ae278d7d9eddc73e3af786e87f;p=koha_fer diff --git a/C4/Images.pm b/C4/Images.pm index 209cde05c4..8b17f1cd2f 100644 --- a/C4/Images.pm +++ b/C4/Images.pm @@ -25,12 +25,12 @@ use 5.010; use C4::Context; use GD; -use vars qw($debug $VERSION @ISA @EXPORT); +use vars qw($debug $noimage $VERSION @ISA @EXPORT); BEGIN { # set the version for version checking - $VERSION = 3.03; + $VERSION = 3.07.00.049; require Exporter; @ISA = qw(Exporter); @EXPORT = qw( @@ -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;