]> git.wh0rd.org - tt-rss.git/blobdiff - include/colors.php
pngcrush.sh
[tt-rss.git] / include / colors.php
index 41bf7b819f023ab9f1471165cada6c31def37cd0..c441f7cb189187bb140f86518ce16d89925faf5c 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 
-require_once "lib/floIcon.php";
+if (file_exists("lib/floIcon.php")) {
+       require_once "lib/floIcon.php";
+}
 
 function _resolve_htmlcolor($color) {
        $htmlcolors = array ("aliceblue" => "#f0f8ff",
@@ -286,16 +288,24 @@ function hsl2rgb($arr) {
 
                $size = @getimagesize($imageFile);
 
-               if (!defined('_DISABLE_FLOICON') && strtolower($size['mime']) == 'image/vnd.microsoft.icon') {
-                       $ico = new floIcon();
-                       @$ico->readICO($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 null;
-                       else
-                               $img = @$ico->images[count($ico->images)-1]->getImageResource();
+                               if(count($ico->images)==0)
+                                       return false;
+                               else
+                                       $img = @$ico->images[count($ico->images)-1]->getImageResource();
 
-               } else {
+                       } else {
+                               return false;
+                       }
+
+               } else if ($size[0] > 0 && $size[1] > 0) {
                   $img = @imagecreatefromstring(file_get_contents($imageFile));
                }
 
@@ -338,4 +348,4 @@ function hsl2rgb($arr) {
                }
                return '';
        }
-?>
+