/**
  * @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('tslib_cObj_getImgResourceHook', array('getImgResourcePostProcess'), array(), $className);
     $getImgResourceHookMock->expects($this->once())->method('getImgResourcePostProcess')->will($this->returnCallback(array($this, 'isGetImgResourceHookCalledCallback')));
     $this->cObj->getImgResourceHookObjects = array($getImgResourceHookMock);
     $this->cObj->IMAGE($this->typoScriptImage);
 }
Exemplo n.º 2
0
 /**
  * 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 {
             $markerArray['###' . $marker . '###'] = $this->local_cObj->wrap($theImgCode, $lConf['imageWrapIfAny']);
         }
     } else {
         if ($lConf['imageMarkerOptionSplit']) {
             $m = '_1';
         } else {
             $m = '';
         }
         $markerArray['###' . $marker . $m . '###'] = $this->local_cObj->stdWrap($markerArray['###' . $marker . $m . '###'], $lConf['image.']['noImage_stdWrap.']);
     }
     //		debug($sViewSplitLConf, '$sViewSplitLConf ('.__CLASS__.'::'.__FUNCTION__.')', __LINE__, __FILE__, 2);
     return $markerArray;
 }
Exemplo n.º 3
0
 /**
  * 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);
 }