Advertisement
drathy

Image Rendering with Crop

Mar 10th, 2020
790
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $contentObjectRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
  2. $filesContent = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\FilesContentObject::class, $contentObjectRenderer);
  3. $filesConfiguration = [
  4.     'references' => $image_reference_uid, // this is a UID from sys_file_reference
  5.     'renderObj' => 'IMAGE',
  6.     'renderObj.' => [
  7.         'file.' => [
  8.             'import.' => [
  9.                 'data' => 'file:current:uid',
  10.             ],
  11.             'treatIdAsReference' => '1',
  12.             'width' => '1360c',
  13.             'height' => '567c',
  14.         ]
  15.     ]
  16. ];
  17. $image_html = $filesContent->render($filesConfiguration);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement