summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/Attachment.pm18
-rw-r--r--Bugzilla/Config/Attachment.pm7
-rw-r--r--Bugzilla/Config/Common.pm11
-rw-r--r--Bugzilla/Install/Requirements.pm6
-rw-r--r--docs/en/xml/installation.xml8
-rw-r--r--docs/en/xml/modules.xml8
-rw-r--r--extensions/bmp_convert/code/attachment-process_data.pl48
-rw-r--r--extensions/bmp_convert/disabled0
-rw-r--r--extensions/bmp_convert/info.pl27
-rw-r--r--template/en/default/admin/params/attachment.html.tmpl6
-rw-r--r--template/en/default/setup/strings.txt.pl1
11 files changed, 78 insertions, 62 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm
index 5ba62e5e5..b1aecd5b0 100644
--- a/Bugzilla/Attachment.pm
+++ b/Bugzilla/Attachment.pm
@@ -568,24 +568,6 @@ sub _check_data {
return $data if ref $data;
$data || ThrowUserError('zero_length_file');
-
- # This should go away, see bug 480986.
- # Windows screenshots are usually uncompressed BMP files which
- # makes for a quick way to eat up disk space. Let's compress them.
- # We do this before we check the size since the uncompressed version
- # could easily be greater than maxattachmentsize.
- if (Bugzilla->params->{'convert_uncompressed_images'}
- && $params->{mimetype} eq 'image/bmp')
- {
- require Image::Magick;
- my $img = Image::Magick->new(magick=>'bmp');
- $img->BlobToImage($data);
- $img->set(magick=>'png');
- my $imgdata = $img->ImageToBlob();
- $data = $imgdata;
- $params->{mimetype} = 'image/png';
- }
-
# Make sure the attachment does not exceed the maximum permitted size.
my $len = length($data);
my $max_size = $params->{store_in_file} ? Bugzilla->params->{'maxlocalattachment'} * 1048576
diff --git a/Bugzilla/Config/Attachment.pm b/Bugzilla/Config/Attachment.pm
index f22c01d95..3468f084c 100644
--- a/Bugzilla/Config/Attachment.pm
+++ b/Bugzilla/Config/Attachment.pm
@@ -84,13 +84,6 @@ sub get_param_list {
type => 't',
default => '0',
checker => \&check_numeric
- },
-
- {
- name => 'convert_uncompressed_images',
- type => 'b',
- default => 0,
- checker => \&check_image_converter
} );
return @param_list;
}
diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm
index b285b3bc9..cb95a2f8d 100644
--- a/Bugzilla/Config/Common.pm
+++ b/Bugzilla/Config/Common.pm
@@ -47,7 +47,7 @@ use base qw(Exporter);
qw(check_multi check_numeric check_regexp check_url check_group
check_sslbase check_priority check_severity check_platform
check_opsys check_shadowdb check_urlbase check_webdotbase
- check_netmask check_user_verify_class check_image_converter
+ check_netmask check_user_verify_class
check_mail_delivery_method check_notification check_utf8
check_bug_status check_smtp_auth check_theschwartz_available
check_maxattachmentsize
@@ -293,15 +293,6 @@ sub check_user_verify_class {
return "";
}
-sub check_image_converter {
- my ($value, $hash) = @_;
- if ($value == 1){
- eval "require Image::Magick";
- return "Error requiring Image::Magick: '$@'" if $@;
- }
- return "";
-}
-
sub check_mail_delivery_method {
my $check = check_multi(@_);
return $check if $check;
diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm
index 0d013f62f..dbcef03bf 100644
--- a/Bugzilla/Install/Requirements.pm
+++ b/Bugzilla/Install/Requirements.pm
@@ -204,12 +204,6 @@ sub OPTIONAL_MODULES {
feature => ['patch_viewer'],
},
{
- package => 'PerlMagick',
- module => 'Image::Magick',
- version => 0,
- feature => ['compress_bmps'],
- },
- {
package => 'perl-ldap',
module => 'Net::LDAP',
version => 0,
diff --git a/docs/en/xml/installation.xml b/docs/en/xml/installation.xml
index 8ced4c69a..cacc4708d 100644
--- a/docs/en/xml/installation.xml
+++ b/docs/en/xml/installation.xml
@@ -1,5 +1,5 @@
<!-- <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"> -->
-<!-- $Id: installation.xml,v 1.168 2009/07/29 12:29:36 lpsolit%gmail.com Exp $ -->
+<!-- $Id: installation.xml,v 1.169 2009/08/13 21:32:19 lpsolit%gmail.com Exp $ -->
<chapter id="installing-bugzilla">
<title>Installing Bugzilla</title>
@@ -412,12 +412,6 @@
<listitem>
<para>
- Image::Magick (&min-image-magick-ver;) for converting BMP image attachments to PNG
- </para>
- </listitem>
-
- <listitem>
- <para>
Net::LDAP
(&min-net-ldap-ver;) for LDAP Authentication
</para>
diff --git a/docs/en/xml/modules.xml b/docs/en/xml/modules.xml
index 3d4f6e556..8a93cb15c 100644
--- a/docs/en/xml/modules.xml
+++ b/docs/en/xml/modules.xml
@@ -181,13 +181,5 @@
Documentation: <ulink url="http://www.johnkeiser.com/mozilla/Patch_Viewer.html"/>
</literallayout>
</para>
-
- <para>
- Image::Magick:
- <literallayout>
- CPAN Download Page: <ulink url="http://search.cpan.org/dist/PerlMagick/"/>
- Documentation: <ulink url="http://www.imagemagick.org/script/resources.php"/>
- </literallayout>
- </para>
</section>
</appendix>
diff --git a/extensions/bmp_convert/code/attachment-process_data.pl b/extensions/bmp_convert/code/attachment-process_data.pl
new file mode 100644
index 000000000..15593cc64
--- /dev/null
+++ b/extensions/bmp_convert/code/attachment-process_data.pl
@@ -0,0 +1,48 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Bug Tracking System.
+#
+# The Initial Developer of the Original Code is Frédéric Buclin.
+# Portions created by Frédéric Buclin are Copyright (C) 2009
+# Frédéric Buclin. All Rights Reserved.
+#
+# Contributor(s): Frédéric Buclin <LpSolit@gmail.com>
+
+use strict;
+
+use Image::Magick;
+use Bugzilla;
+
+my $args = Bugzilla->hook_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();
+}
+
+${$args->{data}} = $data;
+$args->{attributes}->{mimetype} = 'image/png';
+$args->{attributes}->{filename} =~ s/^(.+)\.bmp$/$1.png/i;
+undef $img;
diff --git a/extensions/bmp_convert/disabled b/extensions/bmp_convert/disabled
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/extensions/bmp_convert/disabled
diff --git a/extensions/bmp_convert/info.pl b/extensions/bmp_convert/info.pl
new file mode 100644
index 000000000..0d2ad5eb2
--- /dev/null
+++ b/extensions/bmp_convert/info.pl
@@ -0,0 +1,27 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Bug Tracking System.
+#
+# The Initial Developer of the Original Code is Frédéric Buclin.
+# Portions created by Frédéric Buclin are Copyright (C) 2009
+# Frédéric Buclin. All Rights Reserved.
+#
+# Contributor(s): Frédéric Buclin <LpSolit@gmail.com>
+
+use strict;
+
+{ x_name => 'BMP to PNG converter',
+ version => '1.0',
+ x_description => 'Automatically converts BMP images to the PNG format',
+ x_author => 'Greg Hendricks, Frédéric Buclin',
+};
diff --git a/template/en/default/admin/params/attachment.html.tmpl b/template/en/default/admin/params/attachment.html.tmpl
index 39f60470e..879aa65b1 100644
--- a/template/en/default/admin/params/attachment.html.tmpl
+++ b/template/en/default/admin/params/attachment.html.tmpl
@@ -73,9 +73,5 @@
maxlocalattachment => "The maximum size (in megabytes) of attachments identified by " _
"the user as 'Big Files' to be stored locally on the webserver. " _
"If set to zero, attachments will never be kept on the local " _
- "filesystem.",
-
- convert_uncompressed_images => "If this option is on, attachments with content type image/bmp " _
- "will be converted to image/png and compressed before uploading to " _
- "the database to conserve disk space." }
+ "filesystem." }
%]
diff --git a/template/en/default/setup/strings.txt.pl b/template/en/default/setup/strings.txt.pl
index c46bceabb..4d91da60d 100644
--- a/template/en/default/setup/strings.txt.pl
+++ b/template/en/default/setup/strings.txt.pl
@@ -46,7 +46,6 @@ EOT
feature_auth_ldap => 'LDAP Authentication',
feature_auth_radius => 'RADIUS Authentication',
- feature_compress_bmps => 'Convert BMP Attachments to PNG',
feature_graphical_reports => 'Graphical Reports',
feature_html_desc => 'More HTML in Product/Group Descriptions',
feature_inbound_email => 'Inbound Email',