src/Contao/View/Contao2BackendView/Widget/FileTree.php
protected function renderIcon($model, $imagesOnly = false, $downloads = false)
    {
        if ('folder' === $model->type) {
            if ($imagesOnly || $downloads) {
                return false;
            }

            return Image::getHtml('folderC.svg') . ' ' . $model->path;
        }
        $file = new File($model->path);
        $info = $this->renderFileInfo($file);

        if ($imagesOnly && !$file->isImage) {
            return false;
        }

        if ($downloads) {
            if ($this->isAllowedDownload($file->extension)) {
                return Image::getHtml($file->icon) . ' ' . $info;
            }

            return false;
        }

        if (!$file->isImage) {
            return Image::getHtml($file->icon) . ' ' . $info;
        }

        return $this->generateGalleryImage($model, $file, $info);
    }
protected function renderIcon($model, $imagesOnly = false, $downloads = false)
    {
        if ('folder' === $model->type) {
            if ($imagesOnly || $downloads) {
                return false;
            }

            return Image::getHtml('folderC.svg') . ' ' . $model->path;
        }
        $file = new File($model->path);
        $info = $this->renderFileInfo($file);

        if ($imagesOnly && !$file->isImage) {
            return false;
        }

        if ($downloads) {
            if ($this->isAllowedDownload($file->extension)) {
                return Image::getHtml($file->icon) . ' ' . $info;
            }

            return false;
        }

        if (!$file->isImage) {
            return Image::getHtml($file->icon) . ' ' . $info;
        }

        return $this->generateGalleryImage($model, $file, $info);
    }
protected function renderIcon ( $ model , $ imagesOnly = false , $ downloads = false ) { if ( 'folder' === $ model -> type ) { if ( $ imagesOnly || $ downloads ) { return false ; } return Image :: getHtml ( 'folderC.svg' ) . ' ' . $ model -> path ; } $ file = new File ( $ model -> path ) ; $ info = $ this -> renderFileInfo ( $ file ) ; if ( $ imagesOnly && ! $ file -> isImage ) { return false ; } if ( $ downloads ) { if ( $ this -> isAllowedDownload ( $ file -> extension ) ) { return Image :: getHtml ( $ file -> icon ) . ' ' . $ info ; } return false ; } if ( ! $ file -> isImage ) { return Image :: getHtml ( $ file -> icon ) . ' ' . $ info ; } return $ this -> generateGalleryImage ( $ model , $ file , $ info ) ; }
Render the image of a file.

@param FilesModel $model      The file model.
@param bool       $imagesOnly If true only images are rendered.
@param bool       $downloads  If true file extension has to be in the allowed downloads list.

@return false|string
Render the image of a file .