issue108, a bit more color for tag-cloud
authorAndreas Unterkircher <unki@netshadow.at>
Sat, 29 Mar 2008 07:57:49 +0000 (08:57 +0100)
committerAndreas Unterkircher <unki@netshadow.at>
Sat, 29 Mar 2008 08:18:40 +0000 (09:18 +0100)
Signed-off-by: Andreas Unterkircher <unki@netshadow.at>
CHANGELOG
phpfspot.class.php

index 9cf51cb2592d66167236a9840b04561f7c0e0a9f..e226e78275ac27e502400379d67b35cf8820132f 100644 (file)
--- 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, 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 <unki@netshadow.at>  Sat, 29 Mar 2008 11:00:00 +0100
   * bug, SQlite temporary directory can now be set in phpfspot_cfg.php
 
  -- Andreas Unterkircher <unki@netshadow.at>  Sat, 29 Mar 2008 11:00:00 +0100
index 7cc4e19ec506655a4730b2f163540e6b19c70cb3..be752eedda5fbd7368de4f6d5a08535a2790c3b2 100644 (file)
@@ -586,6 +586,10 @@ class PHPFSPOT {
       $max_size = 125; // max font size in %
       $min_size = 75; // min font size in %
 
       $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));
       // 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);
       // 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) {
 
       // 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);
 
           // 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])) {
          if(isset($this->tags[$key])) {
-            $output.= "<a href=\"javascript:Tags('add', ". $key .");\" class=\"tag\" style=\"font-size: ". $size ."%;\">". $this->tags[$key] ."</a>, ";
+            $output.= "<a href=\"javascript:Tags('add', ". $key .");\" class=\"tag\" style=\"font-size: ". $size ."%; color: #". $r.$g.$b .";\">". $this->tags[$key] ."</a>, ";
          }
 
       }
          }
 
       }