From e1f76af0068bd2cf5ce4a4203b7727d5b3111c04 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 11 Apr 2013 22:01:02 +0400 Subject: block listing of several util directories; deny access to config.php --- lib/index.html | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 lib/index.html (limited to 'lib') diff --git a/lib/index.html b/lib/index.html new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3-54-g00ecf From 2cfbb448fb197837c063c377c042beb3ba704a52 Mon Sep 17 00:00:00 2001 From: moontear Date: Mon, 15 Apr 2013 12:28:52 +0200 Subject: Added average color calculation of feeds' favicons for banded display. --- classes/feeds.php | 5 +- include/functions.php | 42 +++ include/rssfuncs.php | 11 +- lib/floIcon.php | 843 ++++++++++++++++++++++++++++++++++++++++++ schema/versions/mysql/117.sql | 7 + 5 files changed, 903 insertions(+), 5 deletions(-) create mode 100644 lib/floIcon.php create mode 100644 schema/versions/mysql/117.sql (limited to 'lib') diff --git a/classes/feeds.php b/classes/feeds.php index c7b7a83e6..64d1d8786 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -528,8 +528,9 @@ class Feeds extends Handler_Protected { $reply['content'] .= "
"; - $reply['content'] .= "
"; - + //setting feed headline background color, needs to change text color based on dark/light + $favColor = explode("|", $line['favicon_avg_color']); + $reply['content'] .= "
"; $reply['content'] .= "
"; $reply['content'] .= "readICO($iconFile); + //TODO: error logging + if(count($ico->images)==0) + return null; + else { + $image = @$ico->images[count($ico->images)-1]->getImageResource(); + } + $type = "ico"; + } + elseif(strtolower($imgInfo['mime'])=='image/png') { + $image = imagecreatefrompng($iconFile); + $type = 'png'; + } + elseif(strtolower($imgInfo['mime'])=='image/jpeg') { + $image = imagecreatefromjpeg($iconFile); + $type = 'jpg'; + } + elseif(strtolower($imgInfo['mime'])=='image/gif') { + $image = imagecreatefromgif($iconFile); + $type = 'gif'; + } + //TODO: error logging + if (is_null($image)) + return null; + $width = imagesx($image); + $height = imagesy($image); + $pixel = imagecreatetruecolor(1, 1); + imagecopyresampled($pixel, $image, 0, 0, 0, 0, 1, 1, $width, $height); + $rgb = imagecolorat($pixel, 0, 0); + $color = imagecolorsforindex($pixel, $rgb); + return $color; + } function print_select($id, $default, $values, $attributes = "") { print "