Create basic framework
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
24
includes/GlModelViewer.php
Normal file
24
includes/GlModelViewer.php
Normal 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
3
modules/glmv.css
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.glmv-viewer {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
1
modules/glmv.js
Normal file
1
modules/glmv.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
console.log('GLMV JS loaded!')
|
||||||
Reference in New Issue
Block a user