Create basic framework

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
2024-10-20 13:42:14 -07:00
parent e5cc54ffa2
commit 0ff4155168
4 changed files with 51 additions and 1 deletions

View File

@@ -6,5 +6,27 @@
"version": "0.0.1", "version": "0.0.1",
"license-name": "MIT", "license-name": "MIT",
"type": "media", "type": "media",
"manifest_version": 2 "manifest_version": 2,
"AutoloadClasses": {
"GlModelViewer": "includes/GlModelViewer.php"
},
"Hooks": {
"MimeMagicInit": "GlModelViewer::onMimeMagicInit",
"MimeMagicImproveFromExtension": "GlModelViewer::onMimeMagicImproveFromExtension",
"BeforePageDisplay": "GlModelViewer::onBeforePageDisplay"
},
"ResourceFileModulePaths": {
"localBasePath": "modules",
"remoteExtPath": "GlModelViewer/modules"
},
"ResourceModules": {
"ext.glmv": {
"styles": [
"glmv.css"
],
"packageFiles": [
"glmv.js"
]
}
}
} }

View File

@@ -0,0 +1,24 @@
<?php
class GlModelViewer extends ImageHandler {
public static function onMimeMagicInit(MimeAnalyzer $mime) {
$mime->addExtraTypes('application/gltf glb gltf');
$mime->addExtraInfo('application/gltf [DRAWING]');
}
public static function onMimeMagicImproveFromExtension( MimeAnalyzer $mimeAnalyzer, $ext, &$mime ) {
if ( $mime !== 'application/gltf' && in_array( $ext, ['glb', 'gltf'] ) ) {
$mime = 'application/gltf';
}
}
function doTransform($image, $dstPath, $dstUrl, $params, $flags = 0) {
}
public static function onBeforePageDisplay(OutputPage $out) {
if (strpos($out->getHTML(), 'class="glmv-viewer') !== false) {
$out->addModules('ext.glmv');
}
}
}

3
modules/glmv.css Normal file
View File

@@ -0,0 +1,3 @@
.glmv-viewer {
width: 100%;
}

1
modules/glmv.js Normal file
View File

@@ -0,0 +1 @@
console.log('GLMV JS loaded!')