[Rt-commit] rt branch, 4.0/show-valid-image-types, created. rt-4.0.0rc6-31-g4a330c7

Thomas Sibley trs at bestpractical.com
Fri Mar 11 18:58:56 EST 2011


The branch, 4.0/show-valid-image-types has been created
        at  4a330c749a6b170b3fd73b14bef869c8540bda47 (commit)

- Log -----------------------------------------------------------------
commit 9b0faf18f7b2432a1f60c63ac1a62c4a64aabe5d
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 11 18:07:45 2011 -0500

    Give the user a better error message when we can't read an image
    
    This isn't complete, but covers the most common image types that the
    local GD might not support.

diff --git a/share/html/Admin/Tools/Theme.html b/share/html/Admin/Tools/Theme.html
index 0d72300..ae3bac1 100644
--- a/share/html/Admin/Tools/Theme.html
+++ b/share/html/Admin/Tools/Theme.html
@@ -257,7 +257,16 @@ if (    $imgdata
         $colors = analyze_img($img);
     }
     else {
-        push @results, loc("Unable to read image");
+        my %can;
+        for my $type (qw(Png Jpeg Gif)) {
+            $can{$type}++ if GD::Image->can("newFrom${type}Data");
+        }
+        push @results, loc(
+            "Unable to read image to analyze colors. This might be"
+            . " because you uploaded an image type that your particular version"
+            . " of GD doesn't support. Supported types are: [_1]",
+            join(", ", map { uc } keys %can)
+        );
     }
 }
 

commit 4a330c749a6b170b3fd73b14bef869c8540bda47
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 11 18:50:07 2011 -0500

    Don't try to show a user logo if we don't actually have one

diff --git a/share/html/Elements/Logo b/share/html/Elements/Logo
index a6e1719..3a7475b 100644
--- a/share/html/Elements/Logo
+++ b/share/html/Elements/Logo
@@ -70,6 +70,14 @@ if ( exists $ARGS{'show_name'} ) {
 use Scalar::Util qw(blessed);
 my $user_logo = blessed $RT::System ? $RT::System->FirstAttribute('UserLogo') : undef;
 
+# If we have the attribute, but no content, we don't really have a user logo
+if ($user_logo) {
+    my $content = $user_logo->Content;
+    undef $user_logo
+        unless ref $content eq 'HASH'
+           and defined $content->{'data'};
+}
+
 </%INIT>
 <%ARGS>
 $ShowName => 1

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


More information about the Rt-commit mailing list