singleSRC) { $objFile = \FilesModel::findByUuid($this->singleSRC); if ($objFile !== null && is_file(TL_ROOT . '/' . $objFile->path)) { $src = \System::getContainer()->get('contao.image.image_factory')->create(TL_ROOT . '/' . $objFile->path, array(100,40,'crop'))->getUrl(TL_ROOT); $return = ''; } } return $return; } return parent::generate(); } /** * Generate the content element */ protected function compile() { if (TL_MODE == 'BE') { $this->strTemplate = 'be_wildcard'; /** @var \BackendTemplate|object $objTemplate */ $objTemplate = new \BackendTemplate($this->strTemplate); $this->Template = $objTemplate; } if ($this->singleSRC) { $objFile = \FilesModel::findByUuid($this->singleSRC); if ($objFile !== null && is_file(TL_ROOT . '/' . $objFile->path)) { $this->singleSRC = $objFile->path; $this->addImageToTemplate($this->Template, array('singleSRC'=>$this->singleSRC, 'size'=>$this->size)); if ($this->eSM_slick_minHeight) { if ($this->eSM_slick_bgSize && $this->eSM_slick_bgSize == 'auto auto') { $this->Template->minHeight = $this->Template->picture['img']['height'] . 'px'; } else { $this->Template->minHeight = round($this->Template->picture['img']['height'] / $this->Template->picture['img']['width'] * 100) . '%'; } } } $backgroundStyle = 'background-image: url(\''.$this->Template->src.'\');'; if ($this->eSM_slick_bgSize) { $backgroundStyle .= 'background-size: ' . $this->eSM_slick_bgSize . ';'; } else { $backgroundStyle .= 'background-size: cover;'; } if ($this->eSM_slick_bgPosition) { $backgroundStyle .= 'background-position: ' . $this->eSM_slick_bgPosition . ';'; } else { $backgroundStyle .= 'background-position: 0 0;'; } if ($this->eSM_slick_bgOpacity) { $backgroundStyle .= 'opacity:' . $this->eSM_slick_bgOpacity/100 . ';'; } if ($this->eSM_slick_bgRepeat) { $backgroundStyle .= 'background-repeat: ' . $this->eSM_slick_bgRepeat . ';'; } $this->Template->backgroundStyle = $backgroundStyle; } $this->Template->text = nl2br($this->eSM_slick_text); } }