[Rt-commit] rt branch, 4.0/relace-imager-with-gd, created. rt-4.0.0rc4-63-g76c76a2

Thomas Sibley trs at bestpractical.com
Wed Mar 2 15:01:40 EST 2011


The branch, 4.0/relace-imager-with-gd has been created
        at  76c76a2d499f36609966428592cc945bbdf4559e (commit)

- Log -----------------------------------------------------------------
commit 76c76a2d499f36609966428592cc945bbdf4559e
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Mar 2 15:00:21 2011 -0500

    Replace Imager with GD since we already depend on GD for charts
    
    There is no need for multiple image processing libraries in this case
    since we just need pixel RGB data.

diff --git a/README b/README
index 0f833c3..1f17376 100644
--- a/README
+++ b/README
@@ -97,11 +97,9 @@ GENERAL INSTALLATION
     If you are unsure of your CPAN version, it will be printed when you run the
     shell.
 
-    If you are having trouble installing Imager::File::GIF/PNG/JPEG, you will
-    need the appropriate development libraries (giflib-devel, libpng-devel and
-    libjpeg-devel are the rpm names for these libraries).  You may also want to
-    install gd-devel at this time, along with the graphviz rpms (available from
-    graphviz.org) if you want to use graphs and charts.
+    If you are having trouble installing GD or Graphviz, you should install
+    gd-devel and the graphviz libraries using your distribution's package
+    manager.
 
 5   Check to make sure everything was installed properly.
 
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 5b2d2bf..122f41f 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -344,10 +344,6 @@ GD::Text
 .
 
 $deps{'USERLOGO'} = [ text_to_hash( << '.') ];
-Imager
-Imager::File::GIF
-Imager::File::JPEG
-Imager::File::PNG
 Convert::Color
 .
 
diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index 9b1628a..f420e59 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -192,7 +192,7 @@ my $text_threshold = 0.6;
 my @results;
 
 my $has_color_analyzer =
-eval { require Imager; require Convert::Color; 1 };
+eval { require GD; require Convert::Color; 1 };
 
 my $img;
 if (my $file_hash = _UploadedFile( 'logo-upload' )) {
@@ -203,9 +203,8 @@ if (my $file_hash = _UploadedFile( 'logo-upload' )) {
                                                     data => $file_hash->{LargeContent} } );
     push @results, loc("Unable to set UserLogo: [_1]", $msg) unless $id;
 
-    $img = Imager->new;
-    unless ( $img->read(data => $file_hash->{LargeContent}) ) {
-        push @results, loc("Unable to read image: [_1]", $img->errstr);
+    unless ( $img = GD::Image->new($file_hash->{LargeContent}) ) {
+        push @results, loc("Unable to read image");
         undef $img;
     }
 }
@@ -216,9 +215,8 @@ else {
     if (my $attr = RT->System->FirstAttribute('UserLogo')) {
         my $content = $attr->Content;
         if (ref($content) eq 'HASH') {
-            $img = Imager->new;
-            unless ( $img->read(data => $content->{data}) ) {
-                push @results, loc("Unable to read image: [_1]", $img->errstr);
+            unless ( $img = GD::Image->new($content->{data}) ) {
+                push @results, loc("Unable to read image");
                 undef $img;
             }
         }
@@ -260,10 +258,9 @@ sub analyze_img {
     my $img = shift;
     my $color;
 
-    for my $i (0..$img->getwidth-1) {
-        for my $j (0..$img->getheight-1) {
-            my @color = $img->getpixel(x=>$i, y=>$j)->rgba;
-            pop @color;
+    for my $i (0..$img->width-1) {
+        for my $j (0..$img->height-1) {
+            my @color = $img->rgb( $img->getPixel($i,$j) );
             my $hsl = Convert::Color->new('rgb:'.join(',',map { $_ / 255 } @color))->convert_to('hsl');
             my $c = join(',', at color);
             next if $hsl->lightness < 0.1;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list