[TASK] Use simple file backend for core php cache
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_stdgraphic.php
index bc0ad87..0258cd0 100644 (file)
@@ -36,7 +36,7 @@
  * Class contains a bunch of cool functions for manipulating graphics with GDlib/Freetype and ImageMagick
  * VERY OFTEN used with gifbuilder that extends this class and provides a TypoScript API to using these functions
  *
- * With TYPO3 4.4 GDlib 1.x support was dropped, also an option from config_default.php:
+ * With TYPO3 4.4 GDlib 1.x support was dropped, also an option from $TYPO3_CONF_VARS
  * $TYPO3_CONF_VARS['GFX']['gdlib_2'] = 0,     // String/Boolean. Set this if you are using the new GDlib 2.0.1+. If you don't set this flag and still use GDlib2, you might encounter strange behaviours like black images etc. This feature might take effect only if ImageMagick is installed and working as well! You can also use the value "no_imagecopyresized_fix" - in that case it will NOT try to fix a known issue where "imagecopyresized" does not work correctly.
  *
  * @author Kasper Skårhøj <kasperYYYY@typo3.com>
@@ -297,7 +297,6 @@ class t3lib_stdGraphic {
 
                                        // Preserve alpha transparency
                                if ($this->saveAlphaLayer) {
-                                       imagealphablending($destImg, FALSE);
                                        imagesavealpha($destImg, TRUE);
                                        $Bcolor = imagecolorallocatealpha($destImg, 0, 0, 0, 127);
                                        imagefill($destImg, 0, 0, $Bcolor);
@@ -315,7 +314,6 @@ class t3lib_stdGraphic {
                                $cpImg = $this->imageCreateFromFile($BBmask[3]);
                                $destImg = imagecreatetruecolor($w, $h);
                                if ($this->saveAlphaLayer) {
-                                       imagealphablending($destImg, FALSE);
                                        imagesavealpha($destImg, TRUE);
                                        $Bcolor = imagecolorallocatealpha($destImg, 0, 0, 0, 127);
                                        imagefill($destImg, 0, 0, $Bcolor);
@@ -465,11 +463,11 @@ class t3lib_stdGraphic {
         * @see t3lib_iconWorks::imagecopyresized()
         */
        function imagecopyresized(&$dstImg, $srcImg, $dstX, $dstY, $srcX, $srcY, $dstWidth, $dstHeight, $srcWidth, $srcHeight) {
-               if ($this->imagecopyresized_fix) {
+               if ($this->imagecopyresized_fix && !$this->saveAlphaLayer) {
                                // Make true color image
                        $tmpImg = imagecreatetruecolor(imagesx($dstImg), imagesy($dstImg));
                                // Copy the source image onto that
-                       imagecopyresized($tmpImg, $srcImg, 0, 0, 0, 0, imagesx($dstImg), imagesy($dstImg), imagesx($dstImg), imagesy($dstImg));
+                       imagecopyresized($tmpImg, $dstImg, 0, 0, 0, 0, imagesx($dstImg), imagesy($dstImg), imagesx($dstImg), imagesy($dstImg));
                                // Then copy the source image onto that (the actual operation!)
                        imagecopyresized($tmpImg, $srcImg, $dstX, $dstY, $srcX, $srcY, $dstWidth, $dstHeight, $srcWidth, $srcHeight);
                                // Set the destination image
@@ -540,7 +538,7 @@ class t3lib_stdGraphic {
                                $Bcolor = ImageColorAllocate($maskImg, 255, 255, 255);
                                ImageFilledRectangle($maskImg, 0, 0, $newW, $newH, $Bcolor);
                                $Fcolor = ImageColorAllocate($maskImg, 0, 0, 0);
-                                       // If any kind of spacing applys, we use this function:
+                                       // If any kind of spacing applies, we use this function:
                                if ($spacing || $wordSpacing) {
                                        $this->SpacedImageTTFText($maskImg, $conf['fontSize'], $conf['angle'], $txtPos[0], $txtPos[1], $Fcolor, self::prependAbsolutePath($conf['fontFile']), $theText, $spacing, $wordSpacing, $conf['splitRendering.'], $sF);
                                } else {
@@ -2528,6 +2526,7 @@ class t3lib_stdGraphic {
                                );
                                        // If there was a record, the image is being generated by another proces (we assume)
                                if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+                                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
                                        if (is_object($GLOBALS['TSFE'])) {
                                                $GLOBALS['TSFE']->set_no_cache();
                                        } // ...so we set no_cache, because we dont want this page (which will NOT display an image...!) to be cached! (Only a page with the correct image on...)
@@ -2898,7 +2897,6 @@ class t3lib_stdGraphic {
                                if (function_exists('imagecreatefrompng')) {
                                        $imageHandle = imageCreateFromPng($sourceImg);
                                        if ($this->saveAlphaLayer) {
-                                               imagealphablending($imageHandle, FALSE);
                                                imagesavealpha($imageHandle, TRUE);
                                        }
                                        return $imageHandle;
@@ -2996,4 +2994,4 @@ class t3lib_stdGraphic {
        }
 }
 
-?>
\ No newline at end of file
+?>