Conditions | 5 |
Paths | 6 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
31 | public function indexAction() |
||
32 | { |
||
33 | if (!$this->settings['file']) { |
||
34 | throw new \Exception('You have to select a valid FAL reference file', 12372183723); |
||
35 | } |
||
36 | |||
37 | $images = $this->fileRepository->findByRelation( |
||
38 | 'tt_content', |
||
39 | 'pdf', |
||
40 | $this->configurationManager->getContentObject()->data['uid'] |
||
41 | ); |
||
42 | if (!sizeof($images)) { |
||
43 | throw new \Exception('You have to select a valid FAL reference file', 12372183723); |
||
44 | } |
||
45 | /** @var FileReference $image */ |
||
46 | $image = current($images); |
||
47 | |||
48 | $width = MathUtility::canBeInterpretedAsInteger($this->settings['width']) ? $this->settings['width'] . 'px' : $this->settings['width']; |
||
49 | $height = MathUtility::canBeInterpretedAsInteger($this->settings['height']) ? $this->settings['height'] . 'px' : $this->settings['height']; |
||
50 | $fileUrl = GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST') . '/' . $image->getPublicUrl(); |
||
51 | |||
52 | $this->view->assignMultiple([ |
||
53 | 'fileUrl' => urlencode($fileUrl), |
||
54 | 'language' => $GLOBALS['TSFE']->config['config']['language'], |
||
55 | 'width' => $width, |
||
56 | 'height' => $height, |
||
57 | ]); |
||
58 | } |
||
59 | } |
||
60 |