Get preview for this file

@return AssetContainer|DBHTMLText Either a resized thumbnail, or html for a thumbnail icon
358103
public function PreviewThumbnail()
    {
        $width = (int)Config::inst()->get(__CLASS__, 'asset_preview_width');
        return $this->ScaleMaxWidth($width)  ?: $this->IconTag();
    }
567155
public function preview()
	{
		$strPreview = '<div class="widget" style="padding-top:10px;"><h3 style="margin: 0;"><label>' . $this->label . '</label></h3><div class="selector_container"><ul>';

		if ($this->multiArticle)
		{
			$strPreview .= '<li><img src="system/themes/flexible/icons/articles.svg" width="18" height="18" alt=""> Articletitle1</li><li><img src="system/themes/flexible/icons/articles.svg" width="18" height="18" alt=""> Articletitle2</li><li><img src="system/themes/flexible/icons/articles.svg" width="18" height="18" alt=""> Articletitle3</li>';				
		}
		else
		{
			$strPreview .= '<li><img src="system/themes/flexible/icons/articles.svg" width="18" height="18" alt=""> Articletitle</li>';				
		}

		$strPreview .= '</ul><p><a href="javascript:void(0);" class="tl_submit">Change selection</a></p></div><p title="" class="tl_help tl_tip">' . $this->description . '</p></div>';

		return $strPreview;

	}
958023
public function getContent()
    {
        if (null === $this->templateHelper) {
            throw new \RuntimeException('Rokka TemplateHelper is not set in RokkaHash. Needed for downloading images.');
        }
        if (null === $this->content) {
            $rokkaHash = $this->getRokkaHash();
            if (null !== $rokkaHash) {
                $this->content = $this->templateHelper->getRokkaClient()->getSourceImageContents($rokkaHash);
            }
        }

        return $this->content;
    }
602009
public function getPreviewActionAttribute()
    {
        if ($this->changedModel
            && $this->changedModel->uri
            && $this->action != 'deleted') {
            return sprintf('<a href="%s" target="_blank"
                class="glyphicon glyphicon-bookmark js-tooltip"
                title="%s" data-placement="left"></a>',
                $this->preview_url,
                __('decoy::changes.standard_list.preview'));
        } else {
            return '<span class="glyphicon glyphicon-bookmark disabled"></span>';
        }
    }
1113664
public function thumbnail()
    {
        // This part is because of the uploader
        if ($this->type === 'image')
        {
            return $this->wrapThumbnail(
                '<img class="document-thumbnail__image" src="' .
                url(config('imagecache.route') . '/rthumb/' . $this->path). '" alt="' . $this->alttext . '">'
            );
        }

        $icon = 'document';

        if (array_key_exists($this->mimetype, $this->icons))
        {
            $icon = $this->icons[$this->mimetype];
        }

        return $this->iconThumbnail($icon);
    }
780952
public function previewWith($filter, $compact = false)
    {
        return $this->wrapPreview(
            $this->imageWith($filter),
            $compact
        );
    }
3072
public function getEmbedHtml () : string
    {
        if (null === $this->assetHelper && null === $this->packages)
        {
            throw new AssetIntegrationFailedException("No asset integration extension found. Please either install `becklyn/assets-bundle` or `symfony/asset` to use this bundle.");
        }

        $trackJsToken = $this->hostingConfig->getTrackJsToken();

        // only embed if token is set, in production and not in debug
        if (null === $trackJsToken || $this->isDebug || "prod" !== $this->environment)
        {
            return "";
        }

        $assetUrl = null !== $this->assetHelper
            ? $this->assetHelper->getUrl("@hosting/js/trackjs.js")
            : $this->packages->getUrl("bundles/becklynhosting/js/trackjs.js");

        return \sprintf(
            '<script src="%s"></script><script>window.TrackJS && TrackJS.install(%s)</script>',
            $assetUrl,
            \json_encode([
                "token" => $trackJsToken,
                "application" => $this->hostingConfig->getProjectName(),
                "version" => $this->hostingConfig->getGitCommit(),
                "console" => [
                    "display" => false,
                ],
            ])
        );

    }
733408
public function preview(File $file)
    {
        $bbcode = $this->bbcode();

        return preg_replace_callback_array([
            '/\](?<find>.*)\[/' => function ($m) use ($file) {
                return str_replace($m['find'], $file->base_name, $m[0]);
            },
            '/size=(?<find>{.*?})/' => function ($m) use ($file) {
                return str_replace($m['find'], $file->humanSize, $m[0]);
            },
            '/uuid=(?<find>{.*?})/' => function ($m) use ($file) {
                return str_replace($m['find'], $file->uuid, $m[0]);
            },
            '/url=(?<find>{.*?})/' => function ($m) use ($file) {
                return str_replace($m['find'], $file->url, $m[0]);
            },
        ], $bbcode);
    }
718045
public function getRenderInline()
    {
        // Check File Exists / File Extension:
        
        if ($this->owner->exists() && $this->owner->getExtension() == 'svg') {
            
            // Create DOM Document:
            
            $dom = new DOMDocument();
            
            // Load SVG Data into DOM:
            
            $dom->load(BASE_PATH . $this->owner->URL);
            
            // Normalise SVG Data:
            
            $dom->normalizeDocument();
            
            // Render SVG as HTML:
            
            return DBField::create_field('HTMLFragment', $dom->saveHTML($dom->documentElement));
            
        }
    }
1167250
public function getListingThumbnailImage()
    {
        if ($this->fvHasListingThumbnail) {
            $app = Application::getFacadeApplication();
            $config = $app->make('config');
            $listingType = ThumbnailType::getByHandle($config->get('concrete.icons.file_manager_listing.handle'));
            $detailType = ThumbnailType::getByHandle($config->get('concrete.icons.file_manager_detail.handle'));
            $result = '<img class="ccm-file-manager-list-thumbnail ccm-thumbnail-'.$config->get('concrete.file_manager.images.preview_image_size').'" src="' . $this->getThumbnailURL($listingType->getBaseVersion()) . '"';
            if ($config->get('concrete.file_manager.images.create_high_dpi_thumbnails')) {
                $result .= ' data-at2x="' . $this->getThumbnailURL($listingType->getDoubledVersion()) . '"';
            }
            if($config->get('concrete.file_manager.images.preview_image_popover')){
                $result .= ' data-hover-image="'.$this->getThumbnailURL($detailType->getBaseVersion()).'"';
            }
            if ($this->getTypeObject()->isSVG()) {
                $maxWidth = $detailType->getWidth();
                if ($maxWidth) {
                    $result .= ' data-hover-maxwidth="'.$maxWidth.'px"';
                }
                $maxHeight = $detailType->getHeight();
                if ($maxHeight) {
                    $result .= ' data-hover-maxheight="'.$maxHeight.'px"';
                }
            }
            $result .= ' />';
        } else {
            return $this->getTypeObject()->getThumbnail();
        }

        return $result;
    }
1135766
public function src()
    {
        $src = $this->thumbnail();

        if (!$src) {
            $src = $this->file();
        }

        return $this->createAbsoluteUrl($src);
    }
1045019
public function preview()
    {
        $this->blog_post_model->usePreviewTables(true);
        return $this->single($this->uri->rsegment(4), true);
    }
631997
public function getDetailThumbnailImage()
    {
        if ($this->fvHasDetailThumbnail) {
            $app = Application::getFacadeApplication();
            $config = $app->make('config');
            $type = ThumbnailType::getByHandle($config->get('concrete.icons.file_manager_detail.handle'));
            $result = '<img src="' . $this->getThumbnailURL($type->getBaseVersion()) . '"';
            if ($config->get('concrete.file_manager.images.create_high_dpi_thumbnails')) {
                $result .= ' data-at2x="' . $this->getThumbnailURL($type->getDoubledVersion()) . '"';
            }
            $result .= ' />';
        } else {
            $result = $this->getTypeObject()->getThumbnail();
        }

        return $result;
    }
458792
public function renderPreview() {
        $previewFieldMap=array(
                                'ClassName'=>$this->DestinationClass,
                                'IsKapostPreview'=>true,
                                'Children'=>false,
                                'Menu'=>false,
                                'MetaTags'=>false,
                                'Breadcrumbs'=>false,
                                'current_stage'=>Versioned::current_stage(),
                                'SilverStripeNavigator'=>false
                            );
        
        //Allow extensions to add onto the array
        $extensions=$this->extend('updatePreviewFieldMap');
        $extensions=array_filter($extensions, function($v) {return !is_null($v) && is_array($v);});
        if(count($extensions)>0) {
            foreach($extensions as $ext) {
                $previewFieldMap=array_merge($previewFieldMap, $ext);
            }
        }
        
        
        //Find the controller class
        $ancestry=ClassInfo::ancestry($this->DestinationClass);
        while($class=array_pop($ancestry)) {
            if(class_exists($class."_Controller")) {
                break;
            }
        }
        
        $controller=($class!==null ? "{$class}_Controller":"ContentController");
        
        return $controller::create($this)->customise($previewFieldMap);
    }
294486
public function createPreviewTextElement() {
        $options['label']    = $this->translate->_('Preview Text');
        $options['nohidden'] = true;

        return $this->_form->createElement('Html', 'preview_text', $options);
    }
771667
public function preview($id)
    {
        $this->addCss('/modules/system/assets/css/eventlogs/exception-beautifier.css', 'core');
        $this->addJs('/modules/system/assets/js/eventlogs/exception-beautifier.js', 'core');

        if (in_array(App::environment(), ['dev', 'local'])) {
            $this->addJs('/modules/system/assets/js/eventlogs/exception-beautifier.links.js', 'core');
        }

        return $this->asExtension('FormController')->preview($id);
    }
810730
protected function getSource()
	{
		$rootDir = __DIR__ . '/..';
		$src     = '';

		// If getLogger() is not exported we use a dummy Logger that can be optimized away
		$logger = (in_array('getLogger', $this->exports)) ? 'Logger.js' : 'NullLogger.js';

		// Prepare the list of files
		$files   = glob($rootDir . '/Parser/AttributeFilters/*.js');
		$files[] = $rootDir . '/Parser/utils.js';
		$files[] = $rootDir . '/Parser/FilterProcessing.js';
		$files[] = $rootDir . '/Parser/' . $logger;
		$files[] = $rootDir . '/Parser/Tag.js';
		$files[] = $rootDir . '/Parser.js';

		// Append render.js if we export the preview method
		if (in_array('preview', $this->exports, true))
		{
			$files[] = $rootDir . '/render.js';
			$src .= '/** @const */ var xsl=' . $this->getStylesheet() . ";\n";
		}

		$src .= implode("\n", array_map('file_get_contents', $files));

		return $src;
	}