30 public function render($conf = array()) {
32 if (isset($conf[
'text.'])) {
33 $text = $this->cObj->cObjGet($conf[
'text.'],
'text.');
35 $content .= $this->cObj->stdWrap($text, $conf[
'text.']);
37 $imgList = isset($conf[
'imgList.']) ? trim($this->cObj->stdWrap($conf[
'imgList'], $conf[
'imgList.'])) : trim($conf[
'imgList']);
40 $imgStart = isset($conf[
'imgStart.']) ? (int)$this->cObj->stdWrap($conf[
'imgStart'], $conf[
'imgStart.']) : (int)$conf[
'imgStart'];
41 $imgCount = count($imgs) - $imgStart;
42 $imgMax = isset($conf[
'imgMax.']) ? (int)$this->cObj->stdWrap($conf[
'imgMax'], $conf[
'imgMax.']) : (int)$conf[
'imgMax'];
47 $imgPath = isset($conf[
'imgPath.']) ? $this->cObj->stdWrap($conf[
'imgPath'], $conf[
'imgPath.']) : $conf[
'imgPath'];
50 $captionArray = array();
51 if (!$conf[
'captionSplit'] && !$conf[
'imageTextSplit'] && isset($conf[
'caption.'])) {
52 $caption = $this->cObj->cObjGet($conf[
'caption.'],
'caption.');
54 $caption = $this->cObj->stdWrap($caption, $conf[
'caption.']);
56 if ($conf[
'captionSplit'] && $conf[
'captionSplit.'][
'cObject']) {
57 $legacyCaptionSplit = 1;
58 $capSplit = isset($conf[
'captionSplit.'][
'token.']) ? $this->cObj->stdWrap($conf[
'captionSplit.'][
'token'], $conf[
'captionSplit.'][
'token.']) : $conf[
'captionSplit.'][
'token'];
62 $captionArray = explode($capSplit, $this->cObj->cObjGetSingle($conf[
'captionSplit.'][
'cObject'], $conf[
'captionSplit.'][
'cObject.'],
'captionSplit.cObject'));
63 foreach ($captionArray as $ca_key => $ca_val) {
64 $captionArray[$ca_key] = isset($conf[
'captionSplit.'][
'stdWrap.']) ? $this->cObj->stdWrap(trim($captionArray[$ca_key]), $conf[
'captionSplit.'][
'stdWrap.']) : trim($captionArray[$ca_key]);
68 $position = isset($conf[
'textPos.']) ? $this->cObj->stdWrap($conf[
'textPos'], $conf[
'textPos.']) : $conf[
'textPos'];
69 $tmppos = $position & 7;
70 $contentPosition = $position & 24;
71 $align = $this->cObj->align[$tmppos];
72 $cap = $caption ? 1 : 0;
73 $txtMarg = isset($conf[
'textMargin.']) ? (int)$this->cObj->stdWrap($conf[
'textMargin'], $conf[
'textMargin.']) : (int)$conf[
'textMargin'];
74 if (!$conf[
'textMargin_outOfText'] && $contentPosition < 16) {
77 $cols = isset($conf[
'cols.']) ? (int)$this->cObj->stdWrap($conf[
'cols'], $conf[
'cols.']) : (int)$conf[
'cols'];
78 $rows = isset($conf[
'rows.']) ? (int)$this->cObj->stdWrap($conf[
'rows'], $conf[
'rows.']) : (int)$conf[
'rows'];
79 $colspacing = isset($conf[
'colSpace.']) ? (int)$this->cObj->stdWrap($conf[
'colSpace'], $conf[
'colSpace.']) : (int)$conf[
'colSpace'];
80 $rowspacing = isset($conf[
'rowSpace.']) ? (int)$this->cObj->stdWrap($conf[
'rowSpace'], $conf[
'rowSpace.']) : (int)$conf[
'rowSpace'];
81 $border = isset($conf[
'border.']) ? (int)$this->cObj->stdWrap($conf[
'border'], $conf[
'border.']) : (int)$conf[
'border'];
82 $border = $border ? 1 : 0;
84 $borderColor = isset($conf[
'borderCol.']) ? $this->cObj->stdWrap($conf[
'borderCol'], $conf[
'borderCol.']) : $conf[
'borderCol'];
86 $borderColor =
'black';
88 $borderThickness = isset($conf[
'borderThick.']) ? (int)$this->cObj->stdWrap($conf[
'borderThick'], $conf[
'borderThick.']) : (int)$conf[
'borderThick'];
89 if (!$borderThickness) {
90 $borderThickness =
'black';
93 $caption_align = isset($conf[
'captionAlign.']) ? $this->cObj->stdWrap($conf[
'captionAlign'], $conf[
'captionAlign.']) : $conf[
'captionAlign'];
94 if (!$caption_align) {
95 $caption_align = $align;
98 $colCount = $cols > 1 ? $cols : 1;
99 if ($colCount > $imgCount) {
100 $colCount = $imgCount;
102 $rowCount = $colCount > 1 ? ceil($imgCount / $colCount) : $imgCount;
106 if ($rowCount > $imgCount) {
107 $rowCount = $imgCount;
109 $colCount = $rowCount > 1 ? ceil($imgCount / $rowCount) : $imgCount;
112 $colRelations = isset($conf[
'colRelations.']) ? trim($this->cObj->stdWrap($conf[
'colRelations'], $conf[
'colRelations.'])) : trim($conf[
'colRelations']);
113 $maxW = isset($conf[
'maxW.']) ? (int)$this->cObj->stdWrap($conf[
'maxW'], $conf[
'maxW.']) : (int)$conf[
'maxW'];
114 $maxWInText = isset($conf[
'maxWInText.']) ? (int)$this->cObj->stdWrap($conf[
'maxWInText'], $conf[
'maxWInText.']) : (int)$conf[
'maxWInText'];
117 $maxWInText = round($maxW / 2);
120 if ($maxWInText && $contentPosition >= 16) {
124 if ($maxW && $colCount > 0) {
125 $maxW = ceil(($maxW - $colspacing * ($colCount - 1) - $colCount * $border * $borderThickness * 2) / $colCount);
130 $rel_parts = explode(
':', $colRelations);
132 for ($a = 0; $a < $colCount; $a++) {
133 $rel_parts[$a] = (int)$rel_parts[$a];
134 $rel_total += $rel_parts[$a];
137 for ($a = 0; $a < $colCount; $a++) {
138 $colMaxW[$a] = round($maxW * $colCount / $rel_total * $rel_parts[$a]);
141 if (min($colMaxW) <= 0 || max($rel_parts) / min($rel_parts) > 10) {
146 $image_compression = isset($conf[
'image_compression.']) ? (int)$this->cObj->stdWrap($conf[
'image_compression'], $conf[
'image_compression.']) : (int)$conf[
'image_compression'];
147 $image_effects = isset($conf[
'image_effects.']) ? (int)$this->cObj->stdWrap($conf[
'image_effects'], $conf[
'image_effects.']) : (int)$conf[
'image_effects'];
148 $image_frames = isset($conf[
'image_frames.'][
'key.']) ? (int)$this->cObj->stdWrap($conf[
'image_frames.'][
'key'], $conf[
'image_frames.'][
'key.']) : (int)$conf[
'image_frames.'][
'key'];
151 $splitArr[
'imgObjNum'] = $conf[
'imgObjNum'];
152 $splitArr =
$GLOBALS[
'TSFE']->tmpl->splitConfArray($splitArr, $imgCount);
154 $equalHeight = isset($conf[
'equalH.']) ? (int)$this->cObj->stdWrap($conf[
'equalH'], $conf[
'equalH.']) : (int)$conf[
'equalH'];
159 $relations = array();
160 $relations_cols = array();
161 $totalMaxW = $maxW * $colCount;
162 for ($a = 0; $a < $imgCount; $a++) {
163 $imgKey = $a + $imgStart;
164 $imgInfo = $gifCreator->getImageDimensions($imgPath . $imgs[$imgKey]);
166 $relations[$a] = $imgInfo[1] / $equalHeight;
169 if ($relations[$a]) {
171 $relations_cols[floor($a / $colCount)] += $imgInfo[0] / $relations[$a];
176 $imageRowsFinalWidths = array();
177 $imageRowsMaxHeights = array();
179 $origImages = array();
180 for ($a = 0; $a < $imgCount; $a++) {
181 $GLOBALS[
'TSFE']->register[
'IMAGE_NUM'] = $a;
182 $GLOBALS[
'TSFE']->register[
'IMAGE_NUM_CURRENT'] = $a;
183 $imgKey = $a + $imgStart;
187 $totalImagePath = $imgPath . $imgs[$imgKey];
188 $this->cObj->data[$this->cObj->currentValKey] = $totalImagePath;
189 $imgObjNum = (int)$splitArr[$a][
'imgObjNum'];
190 $imgConf = $conf[$imgObjNum .
'.'];
194 $rowTotalMaxW = $relations_cols[floor($a / $colCount)];
195 if ($rowTotalMaxW > $totalMaxW) {
196 $scale = $rowTotalMaxW / $totalMaxW;
200 $imgConf[
'file.'][
'height'] = round($equalHeight / $scale);
201 unset($imgConf[
'file.'][
'width'], $imgConf[
'file.'][
'maxW'], $imgConf[
'file.'][
'maxH'], $imgConf[
'file.'][
'minW'], $imgConf[
'file.'][
'minH'], $imgConf[
'file.'][
'width.'], $imgConf[
'file.'][
'maxW.'], $imgConf[
'file.'][
'maxH.'], $imgConf[
'file.'][
'minW.'], $imgConf[
'file.'][
'minH.']);
206 if (count($colMaxW)) {
207 $imgConf[
'file.'][
'maxW'] = $colMaxW[$a % $colCount];
209 $imgConf[
'file.'][
'maxW'] = $maxW;
213 if (is_array($imgConf)) {
214 if ($this->cObj->image_effects[$image_effects]) {
215 $imgConf[
'file.'][
'params'] .=
' ' . $this->cObj->image_effects[$image_effects];
218 if (is_array($conf[
'image_frames.'][$image_frames .
'.'])) {
219 $imgConf[
'file.'][
'm.'] = $conf[
'image_frames.'][$image_frames .
'.'];
222 if ($image_compression && $imgConf[
'file'] !=
'GIFBUILDER') {
223 if ($image_compression == 1) {
224 $tempImport = $imgConf[
'file.'][
'import'];
225 $tempImport_dot = $imgConf[
'file.'][
'import.'];
226 unset($imgConf[
'file.']);
227 $imgConf[
'file.'][
'import'] = $tempImport;
228 $imgConf[
'file.'][
'import.'] = $tempImport_dot;
229 } elseif (isset($this->cObj->image_compression[$image_compression])) {
230 $imgConf[
'file.'][
'params'] .=
' ' . $this->cObj->image_compression[$image_compression][
'params'];
231 $imgConf[
'file.'][
'ext'] = $this->cObj->image_compression[$image_compression][
'ext'];
232 unset($imgConf[
'file.'][
'ext.']);
236 if (!strlen($imgConf[
'altText']) && !is_array($imgConf[
'altText.'])) {
237 $imgConf[
'altText'] = $conf[
'altText'];
238 $imgConf[
'altText.'] = $conf[
'altText.'];
240 if (!strlen($imgConf[
'titleText']) && !is_array($imgConf[
'titleText.'])) {
241 $imgConf[
'titleText'] = $conf[
'titleText'];
242 $imgConf[
'titleText.'] = $conf[
'titleText.'];
244 if (!strlen($imgConf[
'longdescURL']) && !is_array($imgConf[
'longdescURL.'])) {
245 $imgConf[
'longdescURL'] = $conf[
'longdescURL'];
246 $imgConf[
'longdescURL.'] = $conf[
'longdescURL.'];
250 'altText' => $conf[
'altText'],
251 'titleText' => $conf[
'titleText'],
252 'longdescURL' => $conf[
'longdescURL'],
253 'file' => $totalImagePath
256 $imgsTag[$imgKey] = $this->cObj->IMAGE($imgConf);
258 $origImages[$imgKey] =
$GLOBALS[
'TSFE']->lastImageInfo;
259 $imageRowsFinalWidths[floor($a / $colCount)] +=
$GLOBALS[
'TSFE']->lastImageInfo[0];
260 if (
$GLOBALS[
'TSFE']->lastImageInfo[1] > $imageRowsMaxHeights[floor($a / $colCount)]) {
261 $imageRowsMaxHeights[floor($a / $colCount)] =
$GLOBALS[
'TSFE']->lastImageInfo[1];
266 $tableWidth = max($imageRowsFinalWidths) + $colspacing * ($colCount - 1) + $colCount * $border * $borderThickness * 2;
268 $index = ($imgIndex = $imgStart);
269 $noRows = isset($conf[
'noRows.']) ? $this->cObj->stdWrap($conf[
'noRows'], $conf[
'noRows.']) : $conf[
'noRows'];
270 $noCols = isset($conf[
'noCols.']) ? $this->cObj->stdWrap($conf[
'noCols'], $conf[
'noCols.']) : $conf[
'noCols'];
280 $colCount_temp = $colCount;
282 $rowCount_temp = $rowCount;
289 $colspan = $colspacing ? $colCount * 2 - 1 : $colCount;
290 $rowspan = ($rowspacing ? $rowCount * 2 - 1 : $rowCount) + $cap;
292 if (!is_array($conf[
'editIcons.'])) {
293 $conf[
'editIcons.'] = array();
295 $editIconsHTML = $conf[
'editIcons'] &&
$GLOBALS[
'TSFE']->beUserLogin ? $this->cObj->editIcons(
'', $conf[
'editIcons'], $conf[
'editIcons.']) :
'';
299 $noStretchAndMarginCells = isset($conf[
'noStretchAndMarginCells.']) ? $this->cObj->stdWrap($conf[
'noStretchAndMarginCells'], $conf[
'noStretchAndMarginCells.']) : $conf[
'noStretchAndMarginCells'];
300 if ($noStretchAndMarginCells != 1) {
301 $tablecode .=
'<tr>';
302 if ($txtMarg && $align ==
'right') {
304 $tablecode .=
'<td rowspan="' . ($rowspan + 1) .
'" valign="top"><img src="' .
$GLOBALS[
'TSFE']->absRefPrefix .
'clear.gif" width="' . $txtMarg .
'" height="1" alt="" title="" />' . ($editIconsHTML ?
'<br />' . $editIconsHTML :
'') .
'</td>';
308 $tablecode .=
'<td colspan="' . $colspan .
'"><img src="' .
$GLOBALS[
'TSFE']->absRefPrefix .
'clear.gif" width="' . $tableWidth .
'" height="1" alt="" /></td>';
309 if ($txtMarg && $align ==
'left') {
311 $tablecode .=
'<td rowspan="' . ($rowspan + 1) .
'" valign="top"><img src="' .
$GLOBALS[
'TSFE']->absRefPrefix .
'clear.gif" width="' . $txtMarg .
'" height="1" alt="" title="" />' . ($editIconsHTML ?
'<br />' . $editIconsHTML :
'') .
'</td>';
316 $tableWidth += $txtMarg + 1;
318 $tablecode .=
'</tr>';
322 for ($c = 0; $c < $rowCount; $c++) {
324 if ($c && $rowspacing) {
325 $tablecode .=
'<tr><td colspan="' . $colspan .
'"><img src="' .
$GLOBALS[
'TSFE']->absRefPrefix .
'clear.gif" width="1" height="' . $rowspacing .
'"' . $this->cObj->getBorderAttr(
' border="0"') .
' alt="" title="" /></td></tr>';
328 $tablecode .=
'<tr>';
330 for ($b = 0; $b < $colCount_temp; $b++) {
332 if ($b && $colspacing) {
334 $tablecode .=
'<td><img src="' .
$GLOBALS[
'TSFE']->absRefPrefix .
'clear.gif" width="' . $colspacing .
'" height="1"' . $this->cObj->getBorderAttr(
' border="0"') .
' alt="" title="" /></td>';
336 $colSpacer =
'<img src="' .
$GLOBALS[
'TSFE']->absRefPrefix .
'clear.gif" width="' . ($border ? $colspacing - 6 : $colspacing) .
'" height="' . ($imageRowsMaxHeights[$c] + ($border ? $borderThickness * 2 : 0)) .
'"' . $this->cObj->getBorderAttr(
' border="0"') .
' align="' . ($border ?
'left' :
'top') .
'" alt="" title="" />';
337 $colSpacer =
'<td valign="top">' . $colSpacer .
'</td>';
339 $tablecode .= $colSpacer;
342 if (!$noCols || $noCols && !$b) {
344 $tablecode .=
'<td valign="top">';
346 $tablecode .=
'<table width="' . $imageRowsFinalWidths[$c] .
'" border="0" cellpadding="0" cellspacing="0"><tr>';
352 for ($a = 0; $a < $rowCount_temp; $a++) {
354 $GLOBALS[
'TSFE']->register[
'IMAGE_NUM'] = $imgIndex;
355 $imgIndex = $index + $a * $colCount_temp;
356 $GLOBALS[
'TSFE']->register[
'IMAGE_NUM_CURRENT'] = $imgIndex;
360 if ($imgsTag[$imgIndex]) {
362 if ($rowspacing && $noRows && $a) {
363 $tablecode .=
'<img src="' .
$GLOBALS[
'TSFE']->absRefPrefix .
'clear.gif" width="1" height="' . $rowspacing .
'" alt="" title="" /><br />';
365 if ($legacyCaptionSplit) {
366 $thisCaption = $captionArray[$imgIndex];
367 } elseif (($conf[
'captionSplit'] || $conf[
'imageTextSplit']) && isset($conf[
'caption.'])) {
368 $thisCaption = $this->cObj->cObjGet($conf[
'caption.'],
'caption.');
369 $thisCaption = $this->cObj->stdWrap($thisCaption, $conf[
'caption.']);
371 $imageHTML = $imgsTag[$imgIndex] .
'<br />';
373 $Talign = !trim($thisCaption) && !$noRows ?
' align="left"' :
'';
375 $imageHTML =
'<table border="0" cellpadding="' . $borderThickness .
'" cellspacing="0" bgcolor="' . $borderColor .
'"' . $Talign .
'><tr><td>' . $imageHTML .
'</td></tr></table>';
377 $imageHTML .= $editIconsHTML;
380 $imageHTML .= $thisCaption;
382 $imageHTML =
'<td valign="top">' . $imageHTML .
'</td>';
385 $tablecode .= $imageHTML;
389 if (!$noCols || $noCols && $b + 1 == $colCount_temp) {
391 $tablecode .=
'</tr></table>';
394 $tablecode .=
'</td>';
398 $tablecode .=
'</tr>';
401 switch ($contentPosition) {
408 $table_align =
'margin-left: auto; margin-right: auto';
411 $table_align =
'margin-left: auto; margin-right: 0px';
415 $table_align =
'margin-left: 0px; margin-right: auto';
417 $table_align =
'style="' . $table_align .
'"';
421 $table_align =
'align="' . $align .
'"';
427 $tablecode =
'<table' . ($tableWidth ?
' width="' . $tableWidth .
'"' :
'') .
' border="0" cellspacing="0" cellpadding="0" ' . $table_align .
' class="imgtext-table">' . $tablecode;
429 if ($editIconsHTML) {
430 $tablecode .=
'<tr><td colspan="' . $colspan .
'">' . $editIconsHTML .
'</td></tr>';
434 $tablecode .=
'<tr><td colspan="' . $colspan .
'" align="' . $caption_align .
'">' . $caption .
'</td></tr>';
436 $tablecode .=
'</table>';
437 if (isset($conf[
'tableStdWrap.'])) {
438 $tablecode = $this->cObj->stdWrap($tablecode, $conf[
'tableStdWrap.']);
441 $spaceBelowAbove = isset($conf[
'spaceBelowAbove.']) ? (int)$this->cObj->stdWrap($conf[
'spaceBelowAbove'], $conf[
'spaceBelowAbove.']) : (int)$conf[
'spaceBelowAbove'];
442 switch ($contentPosition) {
445 $output =
'<div style="text-align:' . $align .
';">' . $tablecode .
'</div>' . $this->cObj->wrapSpace($content, ($spaceBelowAbove .
'|0'));
449 $output = $this->cObj->wrapSpace($content, (
'0|' . $spaceBelowAbove)) .
'<div style="text-align:' . $align .
';">' . $tablecode .
'</div>';
453 $output = $tablecode . $content;
458 $theResult .=
'<table border="0" cellspacing="0" cellpadding="0" class="imgtext-nowrap"><tr>';
459 if ($align ==
'right') {
460 $theResult .=
'<td valign="top">' . $content .
'</td><td valign="top">' . $tablecode .
'</td>';
462 $theResult .=
'<td valign="top">' . $tablecode .
'</td><td valign="top">' . $content .
'</td>';
464 $theResult .=
'</tr></table>';
465 $output = $theResult;
471 if (isset($conf[
'stdWrap.'])) {
472 $output = $this->cObj->stdWrap($output, $conf[
'stdWrap.']);
487 $imageFile = $this->fileFactory->getFileReferenceObject($fileUid);
488 $this->cObj->setCurrentFile($imageFile);
static forceIntegerInRange($theInt, $min, $max=2000000000, $defaultValue=0)
static canBeInterpretedAsInteger($var)
static makeInstance($className)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
setCurrentFileInContentObjectRenderer($fileUid)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]