]> git.wh0rd.org - tt-rss.git/blobdiff - include/colors.php
Revert "remove floicon because its author is a colossal shitlord (http://tt-rss.org...
[tt-rss.git] / include / colors.php
index 477a7bd866f29d36570500457dc3c0e70d547208..41bf7b819f023ab9f1471165cada6c31def37cd0 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+require_once "lib/floIcon.php";
+
 function _resolve_htmlcolor($color) {
        $htmlcolors = array ("aliceblue" => "#f0f8ff",
                "antiquewhite" => "#faebd7",
@@ -283,7 +285,19 @@ function hsl2rgb($arr) {
           $colors = array();
 
                $size = @getimagesize($imageFile);
-          $img = @imagecreatefromstring(file_get_contents($imageFile));
+
+               if (!defined('_DISABLE_FLOICON') && strtolower($size['mime']) == 'image/vnd.microsoft.icon') {
+                       $ico = new floIcon();
+                       @$ico->readICO($imageFile);
+
+                       if(count($ico->images)==0)
+                               return null;
+                       else
+                               $img = @$ico->images[count($ico->images)-1]->getImageResource();
+
+               } else {
+                  $img = @imagecreatefromstring(file_get_contents($imageFile));
+               }
 
                if (!$img) return false;