From: Andreas Unterkircher Date: Sat, 29 Mar 2008 07:57:49 +0000 (+0100) Subject: issue108, a bit more color for tag-cloud X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=commitdiff_plain;h=67f0eb35f6c3fe9bdda3cb585a0fe5e9ccb0e563;hp=ef48f1930daad7ffc993708ff9e6656135897964 issue108, a bit more color for tag-cloud Signed-off-by: Andreas Unterkircher --- diff --git a/CHANGELOG b/CHANGELOG index 9cf51cb..e226e78 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ phpfspot (1.4) * feature, support PNG image format. * feature, auto-completion for tag-search. * feature, lightbox2 for photo preview out of the photo index. + * feature, a bit more color for tag-cloud. * bug, SQlite temporary directory can now be set in phpfspot_cfg.php -- Andreas Unterkircher Sat, 29 Mar 2008 11:00:00 +0100 diff --git a/phpfspot.class.php b/phpfspot.class.php index 7cc4e19..be752ee 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -586,6 +586,10 @@ class PHPFSPOT { $max_size = 125; // max font size in % $min_size = 75; // min font size in % + // color + $max_sat = hexdec('cc'); + $min_sat = hexdec('44'); + // get the largest and smallest array values $max_qty = max(array_values($tags)); $min_qty = min(array_values($tags)); @@ -599,6 +603,7 @@ class PHPFSPOT { // determine the font-size increment // this is the increase per tag quantity (times used) $step = ($max_size - $min_size)/($spread); + $step_sat = ($max_sat - $min_sat)/($spread); // loop through our tag array foreach ($tags as $key => $value) { @@ -614,8 +619,14 @@ class PHPFSPOT { // uncomment if you want sizes in whole %: $size = ceil($size); + $color = $min_sat + ($value - $min_qty) * $step_sat; + + $r = '44'; + $g = dechex($color); + $b = '88'; + if(isset($this->tags[$key])) { - $output.= "". $this->tags[$key] .", "; + $output.= "". $this->tags[$key] .", "; } }