[TASK] Remove support for ImageMagick 4 and 5
authorXavier Perseguers <typo3@perseguers.ch>
Wed, 4 May 2011 18:48:18 +0000 (20:48 +0200)
committerJigal van Hemert <jigal@xs4all.nl>
Wed, 11 May 2011 07:48:55 +0000 (09:48 +0200)
IM4 and IM5 support has been deprecated and is scheduled for
removal in TYPO3 4.6.

Change-Id: Ib7610a3666e764e32c854fb04b5d80ef3030dad3
Resolves: #24146
Reviewed-on: http://review.typo3.org/1989
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Steffen Gebert
Tested-by: Steffen Gebert
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
t3lib/class.t3lib_stdgraphic.php
t3lib/config_default.php
typo3/sysext/install/mod/class.tx_install.php

index 3a69414..fe161d5 100644 (file)
@@ -164,7 +164,6 @@ class t3lib_stdGraphic {
        );
        var $NO_IMAGE_MAGICK = '';
        var $V5_EFFECTS = 0;
-       var $im_version_4 = 0;
        var $mayScaleUp = 1;
 
                // Variables for testing, alternative usage etc.
@@ -235,11 +234,12 @@ class t3lib_stdGraphic {
                if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['png_truecolor']) {
                        $this->png_truecolor = TRUE;
                }
-               if (!$gfxConf['im_version_5']) {
-                       t3lib_div::deprecationLog('The option $TYPO3_CONF_VARS[\'GFX\'][\'im_version_5\'] is not set, ImageMagic 4 is assumed. This is deprecated since TYPO3 4.5, support will be removed in TYPO3 4.6. Make sure to upgrade to ImageMagick version 6 or GraphichsMagick.');
-                       $this->im_version_4 = TRUE;
-               } elseif ($gfxConf['im_version_5'] === 'im5') {
-                       t3lib_div::deprecationLog('The option $TYPO3_CONF_VARS[\'GFX\'][\'im_version_5\'] is set to \'im5\'. This is deprecated since TYPO3 4.5, support will be removed in TYPO3 4.6. Make sure to upgrade to ImageMagick version 6 or GraphichsMagick.');
+               if (!$gfxConf['im_version_5'] || $gfxConf['im_version_5'] === 'im4' || $gfxConf['im_version_5'] === 'im5') {
+                       throw new RuntimeException(
+                               'Your TYPO3 installation is configured to use an old version of ImageMagick, which is not supported anymore. ' .
+                               'Please upgrade to ImageMagick version 6 or GraphicksMagick and set $TYPO3_CONF_VARS[\'GFX\'][\'im_version_5\'] appropriately.',
+                               1305059666
+                       );
                }
 
                        // When GIFBUILDER gets used in truecolor mode
@@ -1909,14 +1909,11 @@ class t3lib_stdGraphic {
                $result = $this->randomName() . '.' . $ext;
                if (($reduce = t3lib_div::intInRange($cols, 0, ($ext == 'gif' ? 256 : $this->truecolorColors), 0)) > 0) {
                        $params = ' -colors ' . $reduce;
-                       if (!$this->im_version_4) {
-                                       // IM4 doesn't have this options but forces them automatically if applicaple (<256 colors in image)
-                               if ($reduce <= 256) {
-                                       $params .= ' -type Palette';
-                               }
-                               if ($ext == 'png' && $reduce <= 256) {
-                                       $prefix = 'png8:';
-                               }
+                       if ($reduce <= 256) {
+                               $params .= ' -type Palette';
+                       }
+                       if ($ext == 'png' && $reduce <= 256) {
+                               $prefix = 'png8:';
                        }
                        $this->imageMagickExec($file, $prefix . $result, $params);
                        if ($result) {
index 36b25f3..b477aa1 100644 (file)
@@ -777,9 +777,6 @@ if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['im'])      {
        $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']='gif,jpg,jpeg,png';
        $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] = 0;
 }
-if (!strcmp('0', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']))  {
-       unset($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']);      // Make sure that setting "im_version_5" to "0" means IM4
-}
 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'])        {
        $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_negate_mask'] = 1;
        $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_no_effects'] = 1;
index 0cb1011..dcee4d2 100755 (executable)
@@ -3833,15 +3833,9 @@ REMOTE_ADDR was '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndp
                                                                if (doubleval($version) > 0 && doubleval($version) < 4) {
                                                                                // Assume GraphicsMagick
                                                                        $value_ext = 'gm';
-                                                               } elseif (doubleval($version) < 5) {
-                                                                               // Assume ImageMagick 4.x
-                                                                       $value_ext = '';
-                                                               } elseif (doubleval($version) >= 6) {
+                                                               } else {
                                                                                // Assume ImageMagick 6.x
                                                                        $value_ext = 'im6';
-                                                               } else  {
-                                                                               // Assume ImageMagick 5.x
-                                                                       $value_ext = 'im5';
                                                                }
                                                                if (strcmp(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']), $value_ext)) {
                                                                        $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'GFX\'][\'im_version_5\']', $value_ext);
@@ -4086,10 +4080,6 @@ REMOTE_ADDR was '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndp
                                                        $formArray['im_path'] = array($path);
                                                        $found = 1;
                                                }
-                                       } elseif (!$found) {
-                                               $formArray['im_version_5']=array('im5');
-                                               $formArray['im_path']=array($path);
-                                               $found=1;
                                        }
                                } elseif ($dat['gm']) {
                                        $formArray['im_version_5']=array('gm');
@@ -4536,11 +4526,10 @@ REMOTE_ADDR was '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndp
                        case 'gm':
                                if (doubleval($im_path_version)>=2)     $mismatch=TRUE;
                        break;
-                       case 'im4':
-                               if (doubleval($im_path_version)>=5)     $mismatch=TRUE;
-                       break;
                        default:
-                               if (($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']?TRUE:FALSE) != (doubleval($im_path_version)>=5))        $mismatch=TRUE;
+                               if (($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] ? TRUE : FALSE) != (doubleval($im_path_version) >= 6)) {
+                                       $mismatch = TRUE;
+                               }
                        break;
                }