]> git.wh0rd.org - tt-rss.git/blobdiff - include/colors.php
first stage of headline element handling refactoring
[tt-rss.git] / include / colors.php
index 477a7bd866f29d36570500457dc3c0e70d547208..c441f7cb189187bb140f86518ce16d89925faf5c 100644 (file)
@@ -1,5 +1,9 @@
 <?php
 
+if (file_exists("lib/floIcon.php")) {
+       require_once "lib/floIcon.php";
+}
+
 function _resolve_htmlcolor($color) {
        $htmlcolors = array ("aliceblue" => "#f0f8ff",
                "antiquewhite" => "#faebd7",
@@ -283,7 +287,27 @@ function hsl2rgb($arr) {
           $colors = array();
 
                $size = @getimagesize($imageFile);
-          $img = @imagecreatefromstring(file_get_contents($imageFile));
+
+               // to enable .ico support place floIcon.php into lib/
+               if (strtolower($size['mime']) == 'image/vnd.microsoft.icon') {
+
+                       if (class_exists("floIcon")) {
+
+                               $ico = new floIcon();
+                               @$ico->readICO($imageFile);
+
+                               if(count($ico->images)==0)
+                                       return false;
+                               else
+                                       $img = @$ico->images[count($ico->images)-1]->getImageResource();
+
+                       } else {
+                               return false;
+                       }
+
+               } else if ($size[0] > 0 && $size[1] > 0) {
+                  $img = @imagecreatefromstring(file_get_contents($imageFile));
+               }
 
                if (!$img) return false;
 
@@ -324,4 +348,4 @@ function hsl2rgb($arr) {
                }
                return '';
        }
-?>
+