Added feature #11264: Add an opacity option to the GIFBUILDER BOX object
authorIngo Renner <ingo.renner@typo3.org>
Mon, 20 Jul 2009 15:49:06 +0000 (15:49 +0000)
committerIngo Renner <ingo.renner@typo3.org>
Mon, 20 Jul 2009 15:49:06 +0000 (15:49 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5728 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_stdgraphic.php

index 5abf7fb..d19f8ce 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-07-20  Ingo Renner  <ingo@typo3.org>
+
+       * Added feature #11264: Add an opacity option to the GIFBUILDER BOX object
+
 2009-07-20  Oliver Hader  <oliver@typo3.org>
 
        * Added feature #11509: Move automatic session data garbage collection to separate method
index 09ea63e..eb1c7ef 100644 (file)
@@ -1610,7 +1610,18 @@ class t3lib_stdGraphic   {
                        $reduce = t3lib_div::intInRange($this->setup['reduceColors'], 256, $this->truecolorColors, 256);
                        $this->reduceColors($im, $reduce-1, $reduce-2); // If "reduce-1" colors (or more) are used reduce them to "reduce-2"
                }
-               $tmpColor = ImageColorAllocate($im, $cols[0],$cols[1],$cols[2]);
+
+               $opacity = 0;
+               if (isset($conf['opacity'])) {
+                               // conversion:
+                               // PHP 0 = opaque, 127 = transparent
+                               // TYPO3 100 = opaque, 0 = transparent
+                       $opacity = t3lib_div::intInRange(intval($conf['opacity']), 1, 100, 1);
+                       $opacity = abs($opacity - 100);
+                       $opacity = round((127 * $opacity) / 100);
+               }
+
+               $tmpColor = ImageColorAllocateAlpha($im, $cols[0],$cols[1],$cols[2], $opacity);
                imagefilledrectangle($im, $cords[0], $cords[1], $cords[0]+$cords[2]-1, $cords[1]+$cords[3]-1, $tmpColor);
        }