Fixed bug #12341: Image generation broken with PHPs safe_mode activated and GraphicsM...
authorBenni Mack <benni.mack@typo3.org>
Tue, 5 Jan 2010 12:24:06 +0000 (12:24 +0000)
committerBenni Mack <benni.mack@typo3.org>
Tue, 5 Jan 2010 12:24:06 +0000 (12:24 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6722 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_stdgraphic.php
t3lib/thumbs.php

index 5531daf..0ec27a8 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-01-05  Benjamin Mack  <benni@typo3.org>
+
+       * Fixed bug #12341: Image generation broken with PHPs safe_mode activated and GraphicsMagick (Thanks to Marcus Krause, Helmut Hummel and Bernhard Kraft)
+
 2010-01-04  Steffen Kamper  <info@sk-typo3.de>
 
        * Fixed bug #13096: Unable to disable thumbnails with thumbnailsByDefault (Thanks to Steffen Gebert)
index ae5defb..72eff74 100644 (file)
@@ -2307,7 +2307,7 @@ class t3lib_stdGraphic    {
                                $info[0]=$data[0];
                                $info[1]=$data[1];
 
-                               $frame = $this->noFramePrepended ? '' : '['.intval($frame).']';
+                               $frame = $this->noFramePrepended ? '' : intval($frame);
 
                                if (!$params)   {
                                        $params = $this->cmds[$newExt];
@@ -2326,9 +2326,9 @@ class t3lib_stdGraphic    {
                                $cropscale = ($data['crs'] ? 'crs-V'.$data['cropV'].'H'.$data['cropH'] : '');
 
                                if ($this->alternativeOutputKey)        {
-                                       $theOutputName = t3lib_div::shortMD5($command.$cropscale.basename($imagefile).$this->alternativeOutputKey.$frame);
+                                       $theOutputName = t3lib_div::shortMD5($command.$cropscale.basename($imagefile).$this->alternativeOutputKey.'['.$frame.']');
                                } else {
-                                       $theOutputName = t3lib_div::shortMD5($command.$cropscale.$imagefile.filemtime($imagefile).$frame);
+                                       $theOutputName = t3lib_div::shortMD5($command.$cropscale.$imagefile.filemtime($imagefile).'['.$frame.']');
                                }
                                if ($this->imageMagickConvert_forceFileNameBody)        {
                                        $theOutputName = $this->imageMagickConvert_forceFileNameBody;
@@ -2343,7 +2343,7 @@ class t3lib_stdGraphic    {
                                $GLOBALS['TEMP_IMAGES_ON_PAGE'][] = $output;
 
                                if ($this->dontCheckForExistingTempFile || !$this->file_exists_typo3temp_file($output, $imagefile))     {
-                                       $this->imageMagickExec($imagefile.$frame, $output, $command);
+                                       $this->imageMagickExec($imagefile, $output, $command, $frame);
                                }
                                if (file_exists($output))       {
                                        $info[3] = $output;
@@ -2657,11 +2657,13 @@ class t3lib_stdGraphic  {
         * @param       string          The relative (to PATH_site) image filepath, input file (read from)
         * @param       string          The relative (to PATH_site) image filepath, output filename (written to)
         * @param       string          ImageMagick parameters
+        * @param       string          Refers to which frame-number to select in the image. '' or 0 will select the first frame, 1 will select the next and so on...
         * @return      string          The result of a call to PHP function "exec()"
         */
-       function imageMagickExec($input,$output,$params)        {
+       function imageMagickExec($input,$output,$params,$frame = 0)     {
                if (!$this->NO_IMAGE_MAGICK)    {
-                       $cmd = t3lib_div::imageMagickCommand('convert', $params.' '.$this->wrapFileName($input).' '.$this->wrapFileName($output));
+                       $frame = $frame ? '['.intval($frame).']' : '';
+                       $cmd = t3lib_div::imageMagickCommand('convert', $params.' '.$this->wrapFileName($input).$frame.' '.$this->wrapFileName($output));
                        $this->IM_commands[] = array($output,$cmd);
 
                        $ret = exec($cmd);
index 348cf59..9d72ac3 100644 (file)
@@ -236,7 +236,7 @@ class SC_t3lib_thumbs {
                                        } else {
                                                $colors = ($sizeMax>56)?'-colors 64':'-colors 16';
                                        }
-                                       $parameters = '-sample '.$this->size.' '.$colors.' '.$this->wrapFileName($this->input.'[0]').' '.$this->wrapFileName($this->output);
+                                       $parameters = '-sample '.$this->size.' '.$colors.' '.$this->wrapFileName($this->input).'[0] '.$this->wrapFileName($this->output);
                                        $cmd = t3lib_div::imageMagickCommand('convert', $parameters);
                                        exec($cmd);
                                        if (!file_exists($this->output))        {