Browse Source

* LDV::Filebin : threat djvu and unsupported images as binary

master
Alex 'AdUser' Z 4 years ago
parent
commit
95d45dde0f
  1. 6
      lib/LDV/Filebin.pm

6
lib/LDV/Filebin.pm

@ -95,8 +95,7 @@ sub save {
bytes => $conf->{image_maxmem},
);
# query image
my $image = Imager->new(file => $upload->asset->path)
or die(Imager->errstr() . "\n");
if (my $image = Imager->new(file => $upload->asset->path)) {
$file->{ftype} = 'i';
$file->{fext} = $image->tags(name => 'i_format'),
$file->{res_w} = $image->getwidth,
@ -107,6 +106,9 @@ sub save {
my $path = $self->_file_path("${time}_tn", $conf->{thumbs_ext}, 'fullpath');
$thumb->write(file => $path)
or die $thumb->errstr;
} else {
# unsupported image, djvu, ...
}
} elsif ($file->{fmime} =~ m{^video/}o) {
$file->{ftype} = 'v';
} elsif ($file->{fmime} =~ m{^audio/}o) {

Loading…
Cancel
Save