Quote table names in admin_get_XXX() functions of t3lib_db
[Packages/TYPO3.CMS.git] / t3lib / thumbs.php
index c076a07..460eab7 100755 (executable)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -111,13 +111,13 @@ if (!$TYPO3_CONF_VARS['GFX']['image_processing']) die ('ImageProcessing was disa
  * @subpackage t3lib
  */
 class SC_t3lib_thumbs {
-       var $include_once=array();
+       var $include_once = array();
 
        var $outdir = 'typo3temp/';             // The output directory of temporary files in PATH_site
        var $output = '';
        var $sizeDefault='56x56';
 
-       var $imageList; // Coming from $TYPO3_CONF_VARS['GFX']['imagefile_ext']
+       var $imageList;         // Coming from $TYPO3_CONF_VARS['GFX']['imagefile_ext']
        var $input;             // Contains the absolute path to the file for which to make a thumbnail (after init())
 
                // Internal, static: GPvar:
@@ -143,7 +143,7 @@ class SC_t3lib_thumbs {
                        // Image extension list is set:
                $this->imageList = $TYPO3_CONF_VARS['GFX']['imagefile_ext'];                    // valid extensions. OBS: No spaces in the list, all lowercase...
 
-                       // if the filereference $this->file is relative, we correct the path
+                       // If the filereference $this->file is relative, we correct the path
                if (substr($file,0,3)=='../')   {
                        $file = PATH_site.substr($file,3);
                }
@@ -232,7 +232,6 @@ class SC_t3lib_thumbs {
                                        } else {
                                                $colors = ($sizeMax>56)?'-colors 64':'-colors 16';
                                        }
-                                       $path = $TYPO3_CONF_VARS['GFX']['im_path_lzw'] ? $TYPO3_CONF_VARS['GFX']['im_path_lzw'] : $TYPO3_CONF_VARS['GFX']['im_path'];
                                        $parameters = '-sample '.$this->size.' '.$colors.' '.$this->wrapFileName($this->input.'[0]').' '.$this->wrapFileName($this->output);
                                        $cmd = t3lib_div::imageMagickCommand('convert', $parameters);
                                        exec($cmd);
@@ -242,11 +241,9 @@ class SC_t3lib_thumbs {
                                }
                                        // The thumbnail is read and output to the browser
                                if($fd = @fopen($this->output,'rb'))    {
-                                       Header('Content-type: image/'.$outext);
-                                       while (!feof($fd))      {
-                                               echo fread($fd, 10000);
-                                       }
-                                       fclose( $fd );
+                                       header('Content-type: image/'.$outext);
+                                       fpassthru($fd);
+                                       fclose($fd);
                                } else {
                                        $this->errorGif('Read problem!','',$this->output);
                                }
@@ -289,30 +286,30 @@ class SC_t3lib_thumbs {
 
                        // Creates the basis for the error image
                if ($TYPO3_CONF_VARS['GFX']['gdlib_png'])       {
-                       Header('Content-type: image/png');
+                       header('Content-type: image/png');
                        $im = imagecreatefrompng(PATH_typo3.'gfx/notfound_thumb.png');
                } else {
-                       Header('Content-type: image/gif');
+                       header('Content-type: image/gif');
                        $im = imagecreatefromgif(PATH_typo3.'gfx/notfound_thumb.gif');
                }
                        // Sets background color and print color.
-           $white = ImageColorAllocate($im, 0,0,0);
-           $black = ImageColorAllocate($im, 255,255,0);
+               $white = imageColorAllocate($im, 0,0,0);
+               $black = imageColorAllocate($im, 255,255,0);
 
                        // Prints the text strings with the build-in font functions of GD
                $x=0;
                $font=0;
                if ($l1)        {
                        imagefilledrectangle($im, $x, 9, 56, 16, $black);
-               ImageString($im,$font,$x,9,$l1,$white);
+                       imageString($im,$font,$x,9,$l1,$white);
                }
                if ($l2)        {
                        imagefilledrectangle($im, $x, 19, 56, 26, $black);
-               ImageString($im,$font,$x,19,$l2,$white);
+                       imageString($im,$font,$x,19,$l2,$white);
                }
                if ($l3)        {
                        imagefilledrectangle($im, $x, 29, 56, 36, $black);
-               ImageString($im,$font,$x,29,substr($l3,-14),$white);
+                       imageString($im,$font,$x,29,substr($l3,-14),$white);
                }
 
                        // Outputting the image stream and exit
@@ -340,9 +337,9 @@ class SC_t3lib_thumbs {
                if (!$TYPO3_CONF_VARS['GFX']['gdlib'])  die('');
 
                        // Create image and set background color to white.
-               $im = ImageCreate(250,76);
-           $white = ImageColorAllocate($im, 255,255,255);
-           $col = ImageColorAllocate($im, 0,0,0);
+               $im = imageCreate(250,76);
+               $white = imageColorAllocate($im, 255,255,255);
+               $col = imageColorAllocate($im, 0,0,0);
 
                        // The test string and offset in x-axis.
                $string = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZzÆæØøÅåÄäÖöÜüß';
@@ -364,10 +361,10 @@ class SC_t3lib_thumbs {
 
                        // Output PNG or GIF based on $TYPO3_CONF_VARS['GFX']['gdlib_png']
                if ($TYPO3_CONF_VARS['GFX']['gdlib_png'])       {
-                       Header('Content-type: image/png');
+                       header('Content-type: image/png');
                        imagePng($im);
                } else {
-                       Header('Content-type: image/gif');
+                       header('Content-type: image/gif');
                        imageGif($im);
                }
                imagedestroy($im);
@@ -401,4 +398,4 @@ if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/thumb
 $SOBE = t3lib_div::makeInstance('SC_t3lib_thumbs');
 $SOBE->init();
 $SOBE->main();
-?>
\ No newline at end of file
+?>