本文整理汇总了PHP中TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::IMAGE方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentObjectRenderer::IMAGE方法的具体用法?PHP ContentObjectRenderer::IMAGE怎么用?PHP ContentObjectRenderer::IMAGE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
的用法示例。
在下文中一共展示了ContentObjectRenderer::IMAGE方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getImgResourceHookGetsCalled
/**
* @test
*/
public function getImgResourceHookGetsCalled()
{
$this->template->expects($this->atLeastOnce())->method('getFileName')->with('typo3/clear.gif')->will($this->returnValue('typo3/clear.gif'));
$className = uniqid('tx_coretest');
$getImgResourceHookMock = $this->getMock('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectGetImageResourceHookInterface', array('getImgResourcePostProcess'), array(), $className);
$getImgResourceHookMock->expects($this->once())->method('getImgResourcePostProcess')->will($this->returnCallback(array($this, 'isGetImgResourceHookCalledCallback')));
$getImgResourceHookObjects = array($getImgResourceHookMock);
$this->cObj->_setRef('getImgResourceHookObjects', $getImgResourceHookObjects);
$this->cObj->IMAGE($this->typoScriptImage);
}
示例2: renderLinktypeFile
/**
* Render link of type file
*
* @param array $lConf
* @return array
*/
private function renderLinktypeFile($lConf)
{
$viewAssign = array();
// Get file
$fileRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
$fileObjects = $fileRepository->findByRelation('tt_content', 'mfp_image', $this->data['uid']);
/** @var \TYPO3\CMS\Core\Resource\File $file */
$file = $fileObjects[0];
if (!empty($file)) {
// Configure the image
$this->cObj->setCurrentFile($file);
$imageConf = $GLOBALS['TSFE']->tmpl->setup['lib.']['tx_jhmagnificpopup_pi1.']['image.'];
$imageConf['file.']['treatIdAsReference'] = 1;
$imageConf['file'] = $file;
if (!empty($this->settings['mfpOption']['file_width'])) {
$imageConf["file."]["maxW"] = $this->settings['mfpOption']['file_width'];
}
if (!empty($this->settings['mfpOption']['file_height'])) {
$imageConf["file."]["maxH"] = $this->settings['mfpOption']['file_height'];
}
// Render image
$theImgCode = $this->cObj->IMAGE($imageConf);
// Get image orientation
switch ($this->settings['mfpOption']['file_orient']) {
case 1:
$viewAssign['imageorient'] = 'right';
break;
case 2:
$viewAssign['imageorient'] = 'left';
break;
case 0:
default:
$viewAssign['imageorient'] = 'center';
}
// Get image description/caption
$viewAssign['imagecaption'] = $file->getProperty('description');
// Render typolink
$viewAssign['tsLink'] = $this->cObj->typolink($theImgCode, $lConf);
} else {
$this->addFlashMessage('Please select an image', 'No image', AbstractMessage::WARNING);
}
return $viewAssign;
}
示例3: getFlagImage
/**
* Render the flag image for autorenderer
*
* @param array $language
* @return string
*/
protected function getFlagImage(array $language)
{
$conf = array('file' => $language['flagSrc'], 'altText' => $language['label'], 'titleText' => $language['label']);
return $this->cObj->IMAGE($conf);
}
示例4: getMarkerArray
/**
* Renders values from fieldlist to markers
*
* @param ContentObjectRenderer $cobj Content object
* @param array $conf Configuration for this viewmode
* @param string $prefix Optional prefix for marker
*
* @return array
* @deprecated since commerce 1.0.0, this function will be removed in commerce 1.4.0, please use tx_commerce_pibase->renderElement in combination with $this->returnAssocArray instead
*/
public function getMarkerArray(ContentObjectRenderer &$cobj, array $conf, $prefix = '')
{
\TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
$markContentArray = $this->returnAssocArray('');
$markerArray = array();
foreach ($markContentArray as $k => $v) {
$vr = '';
switch (strtoupper($conf[$k])) {
case 'IMGTEXT':
// fall through
// fall through
case 'IMAGE':
$i = 1;
$imgArray = explode(';', $v);
foreach ($imgArray as $img) {
$conf[$k . '.'][$i . '.'] = $conf[$k . '.']['defaultImgConf.'];
$conf[$k . '.'][$i . '.']['file'] = $conf['imageFolder'] . $img;
$vr = $cobj->IMAGE($conf[$k . '.'][$i . '.']);
}
break;
case 'STDWRAP':
$vr = $cobj->stdWrap($v, $conf[$k . '.']);
break;
default:
$vr = $v;
}
$markerArray['###' . strtoupper($prefix . $k) . '###'] = $vr;
}
return $markerArray;
}
示例5: getSingleViewImages
/**
* Fills the image markers for the SINGLE view with data. Supports Optionssplit for some parameters
*
* @param $lConf
* @param $imgs
* @param $imgsCaptions
* @param $imgsAltTexts
* @param $imgsTitleTexts
* @param $imageNum
* @param $markerArray
* @return mixed
*/
function getSingleViewImages($lConf, $imgs, $imgsCaptions, $imgsAltTexts, $imgsTitleTexts, $imageNum, $markerArray)
{
$marker = 'NEWS_IMAGE';
$sViewSplitLConf = array();
$tmpMarkers = array();
$iC = count($imgs);
// remove first img from image array in single view if the TSvar firstImageIsPreview is set
if ($iC > 1 && $this->config['firstImageIsPreview'] || $iC >= 1 && $this->config['forceFirstImageIsPreview']) {
array_shift($imgs);
array_shift($imgsCaptions);
array_shift($imgsAltTexts);
array_shift($imgsTitleTexts);
$iC--;
}
if ($iC > $imageNum) {
$iC = $imageNum;
}
// get img array parts for single view pages
if ($this->piVars[$this->config['singleViewPointerName']]) {
/**
* TODO
* does this work with optionsplit ?
*/
$spage = $this->piVars[$this->config['singleViewPointerName']];
$astart = $imageNum * $spage;
$imgs = array_slice($imgs, $astart, $imageNum);
$imgsCaptions = array_slice($imgsCaptions, $astart, $imageNum);
$imgsAltTexts = array_slice($imgsAltTexts, $astart, $imageNum);
$imgsTitleTexts = array_slice($imgsTitleTexts, $astart, $imageNum);
}
$osCount = 0;
if ($this->conf['enableOptionSplit']) {
if ($lConf['imageMarkerOptionSplit']) {
$ostmp = explode('|*|', $lConf['imageMarkerOptionSplit']);
$osCount = count($ostmp);
}
$sViewSplitLConf = $this->processOptionSplit($lConf, $iC);
}
// reset markers for optionSplitted images
for ($m = 1; $m <= $imageNum; $m++) {
$markerArray['###' . $marker . '_' . $m . '###'] = '';
}
$cc = 0;
$theImgCode = '';
foreach ($imgs as $val) {
if ($cc == $imageNum) {
break;
}
if ($val) {
if (!empty($sViewSplitLConf[$cc])) {
$lConf = $sViewSplitLConf[$cc];
}
// if (1) {
// $lConf['image.']['imgList.'] = '';
// $lConf['image.']['imgList'] = $val;
// $lConf['image.']['imgPath'] = 'uploads/pics/';
// debug($lConf['image.'], ' ('.__CLASS__.'::'.__FUNCTION__.')', __LINE__, __FILE__, 3);
//
// $imgHtml = $this->local_cObj->IMGTEXT($lConf['image.']);
//
// } else {
$lConf['image.']['altText'] = $imgsAltTexts[$cc];
$lConf['image.']['titleText'] = $imgsTitleTexts[$cc];
$lConf['image.']['file'] = 'uploads/pics/' . $val;
$imgHtml = $this->local_cObj->IMAGE($lConf['image.']) . $this->local_cObj->stdWrap($imgsCaptions[$cc], $lConf['caption_stdWrap.']);
// }
//debug($imgHtml, '$imgHtml ('.__CLASS__.'::'.__FUNCTION__.')', __LINE__, __FILE__, 3);
if ($osCount) {
if ($iC > 1) {
$mName = '###' . $marker . '_' . $lConf['imageMarkerOptionSplit'] . '###';
} else {
// fall back to the first image marker if only one image has been found
$mName = '###' . $marker . '_1###';
}
$tmpMarkers[$mName]['html'] .= $imgHtml;
$tmpMarkers[$mName]['wrap'] = $lConf['imageWrapIfAny'];
} else {
$theImgCode .= $imgHtml;
}
}
$cc++;
}
if ($cc) {
if ($osCount) {
foreach ($tmpMarkers as $mName => $res) {
$markerArray[$mName] = $this->local_cObj->wrap($res['html'], $res['wrap']);
}
} else {
//.........这里部分代码省略.........