2016-11-17 1 views
1

, 우리는 다음과 같이 설정 이미지 필드가 있습니다유체 템플릿에서 FAL 리소스에 액세스 할 수 없음 - 어디에서 볼 수 있습니까? 사용자 정의 extbase 확장에

모델을

/** 
* Returns the picture 
* 
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $picture 
*/ 
public function getPicture() 
{ 
    return $this->picture; 
} 

/** 
* Sets the picture 
* 
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $picture 
* @return void 
*/ 
public function setPicture(\TYPO3\CMS\Extbase\Domain\Model\FileReference $picture) 
{ 
    $this->picture = $picture; 
} 

TCA 내가

를 통해 액체에서 FAL 리소스에 액세스하려고

'picture' => array(
     'exclude' => 0, 
     'label' => 'LLL:EXT:myext/Resources/Private/Language/locallang_db.xlf:tx_myext_domain_model_address.picture', 
     'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
      'picture', 
      array(
       'appearance' => array(
        'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference' 
       ), 
       'foreign_types' => array(
        '0' => array(
         'showitem' => ' 
         --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, 
         --palette--;;filePalette' 
        ), 
        \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => array(
         'showitem' => ' 
         --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, 
         --palette--;;filePalette' 
        ), 
        \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
         'showitem' => ' 
         --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, 
         --palette--;;filePalette' 
        ), 
        \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array(
         'showitem' => ' 
         --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, 
         --palette--;;filePalette' 
        ), 
        \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array(
         'showitem' => ' 
         --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, 
         --palette--;;filePalette' 
        ), 
        \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array(
         'showitem' => ' 
         --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, 
         --palette--;;filePalette' 
        ) 
       ), 
       'maxitems' => 1 
      ), 
      $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] 
     ), 
    ), 

<f:image src="{myextitem.picture}" width="600" height="750c"/> 

빈 이미지 태그가 출력됩니다.

제가

<f:image src="{myextitem.picture.originalResource.publicUrl}" width="600" height="750c"/> 

원래 리소스에 액세스 할 수 있지만, 그 농작물 마법사 화상 수정을 고려하지 않는다.

유체에 의해 FAL 리소스에 액세스 할 수 있도록 만드는 방법은 무엇입니까?

답변

4

ImageViewHelpers render() 메서드를 살펴보십시오. 허용되는 매개 변수가 설명되어 있습니다

* @param string $src a path to a file, a combined FAL identifier or an uid (int). If $treatIdAsReference is set, the integer is considered the uid of the sys_file_reference record. If you already got a FAL object, consider using the $image parameter instead 
* ... 
* @param FileInterface|AbstractFileFolder $image a FAL object 

을 그래서 당신은 src이 문자열을 기대하고 있기 때문에 작동하지 않습니다 src="{imageResource}"를 사용하는 경우.

대신 <f:image image="{imageResource}" width="600" height="750c"/>을 시도하십시오.

+0

yeaaaaah thanks! 나는 두 개의 다른 매개 변수를 의식하지 않았다. 근원에서 VH를 조사하는 것은 좋은 암시입니다. viewhelpers에 대한 정보도 수집하는 IDE가 있습니까? 저는 원자/숭고함을 사용하고 있습니다. 그래서 자주해야 할 핵심 부분을 조사하는 것을 생각하지 않습니다. – Urs

관련 문제