[BUGFIX] Wrong placement of image caption in text with image 84/20884/3
authorPhilipp Gampe <philipp.gampe@typo3.org>
Fri, 17 May 2013 19:02:10 +0000 (21:02 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 29 Jun 2013 12:40:13 +0000 (14:40 +0200)
If you omit the first caption, then the following captions are shifted
into this position, meaning the the captions are off by the number of
empty captions in front.

This happens because the captions are stored with a newline "\n" as
separator which is removed by a trim = 1.

Remove this trim from tt_content.image.20.caption.1.1 as the trimming of
the actual content happens with
tt_content.image.20.caption.1.stdWrap.trim = 1.

The change also has a few cleanups that popped up in PhpStorm while
investigation the issue.

Resolves: #48354
Releases: 6.2, 6.1, 6.0
Change-Id: I4523fa40cbf991b3941d18145a09e72d5e5254d3
Reviewed-on: https://review.typo3.org/20884
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/css_styled_content/Classes/Controller/CssStyledContentController.php
typo3/sysext/css_styled_content/static/setup.txt
typo3/sysext/css_styled_content/static/v6.0/setup.txt
typo3/sysext/css_styled_content/static/v6.1/setup.txt

index 3a06f7c..fea7c9b 100644 (file)
@@ -582,7 +582,7 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
                                if ($rel) {
                                        $imgWidths[$a] = $imgInfo[0] / $rel;
                                        // counts the total width of the row with the new height taken into consideration.
-                                       $relations_cols[floor($a / $colCount)] += $imgWidths[$a];
+                                       $relations_cols[(int)floor($a / $colCount)] += $imgWidths[$a];
                                }
                        }
                }
@@ -598,7 +598,7 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
                $rowIdx = 0;
                for ($a = 0; $a < $imgCount; $a++) {
                        $imgKey = $a + $imgStart;
-                       // if the image cannot be interpreted as integer (therefore filename and no FAL id), add the image path
+                       // If the image cannot be interpreted as integer (therefore filename and no FAL id), add the image path
                        if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($imgs[$imgKey])) {
                                $totalImagePath = intval($imgs[$imgKey]);
                        } else {
@@ -730,9 +730,9 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
                        // Store the original filepath
                        $origImages[$imgKey] = $GLOBALS['TSFE']->lastImageInfo;
                        if ($GLOBALS['TSFE']->lastImageInfo[0] == 0) {
-                               $imageRowsFinalWidths[floor($a / $colCount)] += $this->cObj->data['imagewidth'];
+                               $imageRowsFinalWidths[(int)floor($a / $colCount)] += $this->cObj->data['imagewidth'];
                        } else {
-                               $imageRowsFinalWidths[floor($a / $colCount)] += $GLOBALS['TSFE']->lastImageInfo[0];
+                               $imageRowsFinalWidths[(int)floor($a / $colCount)] += $GLOBALS['TSFE']->lastImageInfo[0];
                        }
                }
                // How much space will the image-block occupy?
index d2b23c9..4d7241e 100644 (file)
@@ -783,7 +783,6 @@ tt_content.image.20 {
                                required = 1
                                parseFunc =< lib.parseFunc
                                br = 1
-                               trim = 1
                                split.token.char = 10
                                split.token.if.isPositive = {$styles.content.imgtext.imageTextSplit} + {$styles.content.imgtext.captionSplit}
                                split.returnKey.data = register : IMAGE_NUM_CURRENT
index 8a31978..c563eb7 100644 (file)
@@ -800,7 +800,6 @@ tt_content.image.20 {
                                required = 1
                                parseFunc =< lib.parseFunc
                                br = 1
-                               trim = 1
                                split.token.char = 10
                                split.token.if.isPositive = {$styles.content.imgtext.imageTextSplit} + {$styles.content.imgtext.captionSplit}
                                split.returnKey.data = register : IMAGE_NUM_CURRENT
index 713c5c4..7aa8d8e 100644 (file)
@@ -800,7 +800,6 @@ tt_content.image.20 {
                                required = 1
                                parseFunc =< lib.parseFunc
                                br = 1
-                               trim = 1
                                split.token.char = 10
                                split.token.if.isPositive = {$styles.content.imgtext.imageTextSplit} + {$styles.content.imgtext.captionSplit}
                                split.returnKey.data = register : IMAGE_NUM_CURRENT