// initialisation
$caption='';
+ $captionArray = array();
if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) {
$caption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']); // global caption, no splitting
}
+ if ($conf['captionSplit'] && $conf['captionSplit.']['cObject']) {
+ $legacyCaptionSplit = 1;
+ $capSplit = $this->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']);
+ if (!$capSplit) {$capSplit=chr(10);}
+ $captionArray = explode($capSplit, $this->cObjGetSingle($conf['captionSplit.']['cObject'], $conf['captionSplit.']['cObject.'], 'captionSplit.cObject'));
+ while (list($ca_key, $ca_val) = each($captionArray)) {
+ $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']);
+ }
+ }
$tablecode='';
$position=$this->stdWrap($conf['textPos'],$conf['textPos.']);
$origImages=array();
for($a=0;$a<$imgCount;$a++) {
$GLOBALS['TSFE']->register['IMAGE_NUM'] = $a;
+ $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a;
$imgKey = $a+$imgStart;
$totalImagePath = $imgPath.$imgs[$imgKey];
for ($a=0;$a<$rowCount_temp;$a++) { // Looping through the rows IF "noRows" is set. "noRows" means that the rows of images is not rendered by physical table rows but images are all in one column and spaced apart with clear-gifs. This loop is only one time if "noRows" is not set.
$GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex; // register previous imgIndex
$imgIndex = $index+$a*$colCount_temp;
+ $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgIndex;
if ($imgsTag[$imgIndex]) {
if ($rowspacing && $noRows && $a) { // Puts distance between the images IF "noRows" is set and this is the first iteration of the loop
$tablecode.= '<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'" alt="" title="" /><br />';
}
- if ($conf['captionSplit'] || $conf['imageTextSplit']) {
+ if ($legacyCaptionSplit) {
+ $thisCaption = $captionArray[$imgIndex];
+ } else if ($conf['captionSplit'] || $conf['imageTextSplit']) {
$thisCaption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
}
$imageHTML = $imgsTag[$imgIndex].'<br />';
$totalImagePath = $imgPath.$imgs[$imgKey];
$GLOBALS['TSFE']->register['IMAGE_NUM'] = $a;
+ $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a;
$GLOBALS['TSFE']->register['ORIG_FILENAME'] = $totalImagePath;
$this->cObj->data[$this->cObj->currentValKey] = $totalImagePath;
$images = '';
for ($c = 0; $c < $imageWrapCols; $c++) {
$tmpColspacing = $colspacing;
- if (($c==$imageWrapCols-1 && $imagePosition==2) || ($c==0 && $imagePosition==1)) {
+ if (($c==$imageWrapCols-1 && $imagePosition==2) || ($c==0 && ($imagePosition==1||$imagePosition==0))) {
+ // Do not add spacing after column if we are first column (left) or last column (center/right)
$tmpColspacing = 0;
}
- $GLOBALS['TSFE']->register['columnwidth'] = $columnWidths[$c] + $tmpColspacing + $border*($borderSpace+$borderThickness)*2;
+
$thisImages = '';
$allRows = '';
+ $maxImageSpace = 0;
for ($i = $c; $i<count($imgsTag); $i=$i+$imageWrapCols) {
$colPos = $i%$colCount;
if ($separateRows && $colPos == 0) {
}
// Render one image
+ $imageSpace = $origImages[$i][0] + $border*($borderSpace+$borderThickness)*2;
$GLOBALS['TSFE']->register['IMAGE_NUM'] = $i;
+ $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $i;
$GLOBALS['TSFE']->register['ORIG_FILENAME'] = $origImages[$i]['origFile'];
$GLOBALS['TSFE']->register['imagewidth'] = $origImages[$i][0];
- $GLOBALS['TSFE']->register['imagespace'] = $origImages[$i][0] + $border*($borderSpace+$borderThickness)*2;
+ $GLOBALS['TSFE']->register['imagespace'] = $imageSpace;
$GLOBALS['TSFE']->register['imageheight'] = $origImages[$i][1];
-
+ if ($imageSpace > $maxImageSpace) {
+ $maxImageSpace = $imageSpace;
+ }
$thisImage = '';
$thisImage .= $this->cObj->stdWrap($imgsTag[$i], $conf['imgTagStdWrap.']);
} else {
$allRows .= $thisImage;
}
+ $GLOBALS['TSFE']->register['columnwidth'] = $maxImageSpace + $tmpColspacing;
if ($separateRows && ($colPos == ($colCount-1) || $i+1==count($imgsTag))) {
// Close this row at the end (colCount), or the last row at the final end
$allRows .= $this->cObj->stdWrap($thisRow, $conf['imageRowStdWrap.']);
enable.field = image_zoom
enable.ifEmpty.typolink.parameter.field = image_link
- enable.ifEmpty.typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM
+ enable.ifEmpty.typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT
enable.ifEmpty.typolink.returnLast = url
typolink.parameter.field = image_link
- typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM
+ typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT
typolink.target = {$styles.content.links.target}
typolink.extTarget = {$styles.content.links.extTarget}
}
field = altText
split.token.char = 10
split.token.if.isTrue = {$styles.content.imgtext.imageTextSplit}
- split.returnKey.data = register : IMAGE_NUM
+ split.returnKey.data = register : IMAGE_NUM_CURRENT
}
titleText < .altText
wrapAlign.field = imagecaption_position
split.token.char = 10
split.token.if.isPositive = {$styles.content.imgtext.imageTextSplit} + {$styles.content.imgtext.captionSplit}
- split.returnKey.data = register : IMAGE_NUM
+ split.returnKey.data = register : IMAGE_NUM_CURRENT
}
}
# captionSplit is deprecated, use imageTextSplit instead