Add basic thumbnail handling with static image

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
2024-10-30 09:28:29 -07:00
parent 11bac465d9
commit 64140b7cd9
5 changed files with 28 additions and 23 deletions

View File

@@ -52,22 +52,6 @@ class GlModelHooks {
}
}
/**
* MWHook: Display model on file page
*
* @see https://www.mediawiki.org/wiki/Manual:Hooks/ImageOpenShowImageInlineBefore
*
* @param ImagePage $imagepage information regarding the page for the image file
* @param OutputPage $out compiled page html and manipulation methods
*/
public static function onImageOpenShowImageInlineBefore( $imagepage, $out ){
$file = $imagepage->getFile();
if ($file->getMimeType() == 'model/gltf-binary') {
$out->clearHTML();
$out->addWikiTextAsContent('[[' . $file->getTitle()->getFullText() . '|800x600px]]');
}
}
/**
* MWHook: Display model when model file page edits are previewed
*
@@ -88,7 +72,7 @@ class GlModelHooks {
$out = $editor->getContext()->getOutput();
$out->addModules('ext.glmv');
$mvTransform = $file->transform([ 'width' => '800', 'hight' => '600']);
$mvTransform = $file->transform([ 'width' => '800', 'hight' => '600', 'view' => 'test']);
$previewViewer = $mvTransform->toHtml([ 'preview' => true]);
$addButtonAttr = array(