Fixed issue #16940: htmlArea RTE: Log magic image creation failures to syslog
authorStanislas Rolland <typo3@sjbr.ca>
Thu, 6 Jan 2011 23:38:33 +0000 (23:38 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Thu, 6 Jan 2011 23:38:33 +0000 (23:38 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@10002 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php

index 7de6744..3a8cdb9 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-01-06  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed issue #16940: htmlArea RTE: Log magic image creation failures to syslog
+
 2011-01-06  Steffen Gebert  <steffen@steffen-gebert.de>
 
        * Fixed bug #16828: missing XCLASS statement in t3lib/class.t3lib_compressor.php
index cbff479..5a0200e 100644 (file)
@@ -1,3 +1,7 @@
+2011-01-06  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed issue #16940: htmlArea RTE: Log magic image creation failures to syslog
+
 2010-12-22  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #16823: htmlArea RTE: Abbreviation dialogue and table lack contextual help
index 1de1ab1..69337cb 100644 (file)
@@ -329,33 +329,43 @@ class tx_rtehtmlarea_select_image extends browse_links {
         * @return      void
         */
        public function insertMagicImage($filepath, $imgInfo, $altText='', $titleText='', $additionalParams='') {
-               if (is_array($imgInfo) && count($imgInfo)==4 && $this->RTEImageStorageDir)      {
-                       $fI = pathinfo($imgInfo[3]);
-                       $fileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
-                       $basename = $fileFunc->cleanFileName('RTEmagicP_'.$fI['basename']);
-                       $destPath =PATH_site.$this->RTEImageStorageDir;
-                       if (@is_dir($destPath)) {
-                               $destName = $fileFunc->getUniqueName($basename,$destPath);
-                               @copy($imgInfo[3],$destName);
-                               t3lib_div::fixPermissions($destName);
-                               $cWidth = t3lib_div::intInRange(t3lib_div::_GP('cWidth'), 0, $this->magicMaxWidth);
-                               $cHeight = t3lib_div::intInRange(t3lib_div::_GP('cHeight'), 0, $this->magicMaxHeight);
-                               if (!$cWidth)   $cWidth = $this->magicMaxWidth;
-                               if (!$cHeight)  $cHeight = $this->magicMaxHeight;
-
-                               $imgI = $this->imgObj->imageMagickConvert($filepath,'WEB',$cWidth.'m',$cHeight.'m');    // ($imagefile,$newExt,$w,$h,$params,$frame,$options,$mustCreate=0)
-                               if ($imgI[3])   {
-                                       $fI=pathinfo($imgI[3]);
-                                       $mainBase='RTEmagicC_'.substr(basename($destName),10).'.'.$fI['extension'];
-                                       $destName = $fileFunc->getUniqueName($mainBase,$destPath);
-                                       @copy($imgI[3],$destName);
+               if (is_array($imgInfo) && count($imgInfo) == 4) {
+                       if ($this->RTEImageStorageDir) {
+                               $fI = pathinfo($imgInfo[3]);
+                               $fileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
+                               $basename = $fileFunc->cleanFileName('RTEmagicP_'.$fI['basename']);
+                               $destPath =PATH_site.$this->RTEImageStorageDir;
+                               if (@is_dir($destPath)) {
+                                       $destName = $fileFunc->getUniqueName($basename,$destPath);
+                                       @copy($imgInfo[3],$destName);
                                        t3lib_div::fixPermissions($destName);
-                                       $destName = dirname($destName).'/'.rawurlencode(basename($destName));
-                                       $iurl = $this->siteURL.substr($destName,strlen(PATH_site));
-                                       $this->imageInsertJS($iurl, $imgI[0], $imgI[1], $altText, $titleText, $additionalParams);
+                                       $cWidth = t3lib_div::intInRange(t3lib_div::_GP('cWidth'), 0, $this->magicMaxWidth);
+                                       $cHeight = t3lib_div::intInRange(t3lib_div::_GP('cHeight'), 0, $this->magicMaxHeight);
+                                       if (!$cWidth)   $cWidth = $this->magicMaxWidth;
+                                       if (!$cHeight)  $cHeight = $this->magicMaxHeight;
+       
+                                       $imgI = $this->imgObj->imageMagickConvert($filepath,'WEB',$cWidth.'m',$cHeight.'m');    // ($imagefile,$newExt,$w,$h,$params,$frame,$options,$mustCreate=0)
+                                       if ($imgI[3])   {
+                                               $fI=pathinfo($imgI[3]);
+                                               $mainBase='RTEmagicC_'.substr(basename($destName),10).'.'.$fI['extension'];
+                                               $destName = $fileFunc->getUniqueName($mainBase,$destPath);
+                                               @copy($imgI[3],$destName);
+                                               t3lib_div::fixPermissions($destName);
+                                               $destName = dirname($destName).'/'.rawurlencode(basename($destName));
+                                               $iurl = $this->siteURL.substr($destName,strlen(PATH_site));
+                                               $this->imageInsertJS($iurl, $imgI[0], $imgI[1], $altText, $titleText, $additionalParams);
+                                       } else {
+                                               t3lib_div::sysLog('Attempt at creating a magic image failed due to error converting image: "' . $filepath . '".', $this->extKey . '/tx_rtehtmlarea_select_image', t3lib_div::SYSLOG_SEVERITY_ERROR);
+                                       }
+                               } else {
+                                       t3lib_div::sysLog('Attempt at creating a magic image failed due to incorrect destination path: "' . $destPath . '".', $this->extKey . '/tx_rtehtmlarea_select_image', t3lib_div::SYSLOG_SEVERITY_ERROR);
                                }
+                       } else {
+                               t3lib_div::sysLog('Attempt at creating a magic image failed due to absent RTE_imageStorageDir', $this->extKey . '/tx_rtehtmlarea_select_image', t3lib_div::SYSLOG_SEVERITY_ERROR);
                        }
-               }
+               } else {
+                       t3lib_div::sysLog('Attempt at creating a magic image failed due to missing image file info.', $this->extKey . '/tx_rtehtmlarea_select_image', t3lib_div::SYSLOG_SEVERITY_ERROR);
+               }       
        }
 
        /**