diff options
author | Perl Tidy <perltidy@bugzilla.org> | 2019-01-30 20:00:43 -0500 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2019-01-30 20:31:44 -0500 |
commit | 7f3a749d7bd78a3e4aee163f562d7e95b0954b44 (patch) | |
tree | f86271c0b1f3ece6d55d8fa44767d41bb890f1f6 /extensions/BmpConvert | |
parent | Bug 1226123 - Email addresses with an apostrophe in them break the "Send Mail... (diff) | |
download | bugzilla-7f3a749d7bd78a3e4aee163f562d7e95b0954b44.tar.gz bugzilla-7f3a749d7bd78a3e4aee163f562d7e95b0954b44.tar.bz2 bugzilla-7f3a749d7bd78a3e4aee163f562d7e95b0954b44.zip |
no bug - reformat all the code using the new perltidy rules
Diffstat (limited to 'extensions/BmpConvert')
-rw-r--r-- | extensions/BmpConvert/Config.pm | 9 | ||||
-rw-r--r-- | extensions/BmpConvert/Extension.pm | 49 |
2 files changed, 27 insertions, 31 deletions
diff --git a/extensions/BmpConvert/Config.pm b/extensions/BmpConvert/Config.pm index 4984f19a9..ed2df6197 100644 --- a/extensions/BmpConvert/Config.pm +++ b/extensions/BmpConvert/Config.pm @@ -12,12 +12,7 @@ use strict; use warnings; use constant NAME => 'BmpConvert'; -use constant REQUIRED_MODULES => [ - { - package => 'PerlMagick', - module => 'Image::Magick', - version => 0, - }, -]; +use constant REQUIRED_MODULES => + [{package => 'PerlMagick', module => 'Image::Magick', version => 0,},]; __PACKAGE__->NAME; diff --git a/extensions/BmpConvert/Extension.pm b/extensions/BmpConvert/Extension.pm index b8201f106..d9e3d0ef4 100644 --- a/extensions/BmpConvert/Extension.pm +++ b/extensions/BmpConvert/Extension.pm @@ -18,29 +18,30 @@ use Image::Magick; our $VERSION = '1.0'; sub attachment_process_data { - my ($self, $args) = @_; - return unless $args->{attributes}->{mimetype} eq 'image/bmp'; - - my $data = ${$args->{data}}; - my $img = Image::Magick->new(magick => 'bmp'); - - # $data is a filehandle. - if (ref $data) { - $img->Read(file => \*$data); - $img->set(magick => 'png'); - $img->Write(file => \*$data); - } - # $data is a blob. - else { - $img->BlobToImage($data); - $img->set(magick => 'png'); - $data = $img->ImageToBlob(); - } - undef $img; - - ${$args->{data}} = $data; - $args->{attributes}->{mimetype} = 'image/png'; - $args->{attributes}->{filename} =~ s/^(.+)\.bmp$/$1.png/i; + my ($self, $args) = @_; + return unless $args->{attributes}->{mimetype} eq 'image/bmp'; + + my $data = ${$args->{data}}; + my $img = Image::Magick->new(magick => 'bmp'); + + # $data is a filehandle. + if (ref $data) { + $img->Read(file => \*$data); + $img->set(magick => 'png'); + $img->Write(file => \*$data); + } + + # $data is a blob. + else { + $img->BlobToImage($data); + $img->set(magick => 'png'); + $data = $img->ImageToBlob(); + } + undef $img; + + ${$args->{data}} = $data; + $args->{attributes}->{mimetype} = 'image/png'; + $args->{attributes}->{filename} =~ s/^(.+)\.bmp$/$1.png/i; } - __PACKAGE__->NAME; +__PACKAGE__->NAME; |