Add basic thumbnail handling with static image
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -18,10 +18,10 @@ class GlModelTransformOutput extends MediaTransformOutput {
|
||||
public function __construct($file, $parameters) {
|
||||
$this->file = $file;
|
||||
$this->parameters = $parameters;
|
||||
$this->width = (isset($parameters['width'])) ? $parameters['width'] : '800';
|
||||
$this->height = (isset($parameters['height'])) ? $parameters['height'] : (int)($this->width * .75);
|
||||
$this->width = $parameters['width'];
|
||||
$this->height = $parameters['height'];
|
||||
$this->url = $file->getFullUrl();
|
||||
$this->thumb = isset($parameters['isFilePageThumb']);
|
||||
$this->thumb = isset($parameters['isFilePageThumb']) && $parameters['isFilePageThumb'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,13 @@ class GlModelTransformOutput extends MediaTransformOutput {
|
||||
*/
|
||||
public function toHtml($options = []) {
|
||||
if ($this->thumb) {
|
||||
return Html::rawElement('span',['class' => 'fake-thumbnail'],'Gltf model thumbnail');
|
||||
$mainConfig = ConfigFactory::getDefaultInstance()->makeConfig( 'main' );
|
||||
$thumbUrl = $mainConfig->get( 'ExtensionAssetsPath' ) . '/GlModelViewer/resources/model_thumb.svg';
|
||||
$attrMenuImg = array (
|
||||
'src' => $thumbUrl,
|
||||
'style' => 'width: ' . $this->width . 'px; height: ' . $this->height . 'px;'
|
||||
);
|
||||
return Html::rawElement('img', $attrMenuImg, '');
|
||||
}
|
||||
|
||||
if (isset($options['img-class'])) {
|
||||
|
||||
Reference in New Issue
Block a user