25 lines
745 B
PHP
25 lines
745 B
PHP
<?php
|
|
|
|
class GlModelViewer extends ImageHandler {
|
|
public static function onMimeMagicInit(MimeAnalyzer $mime) {
|
|
$mime->addExtraTypes('model/gltf-binary glb gltf');
|
|
$mime->addExtraInfo('model/gltf-binary [DRAWING]');
|
|
}
|
|
|
|
public static function onMimeMagicImproveFromExtension( MimeAnalyzer $mimeAnalyzer, $ext, &$mime ) {
|
|
if ( $mime !== 'model/gltf-binary' && in_array( $ext, ['glb', 'gltf'] ) ) {
|
|
$mime = 'model/gltf-binary';
|
|
}
|
|
}
|
|
|
|
function doTransform($image, $dstPath, $dstUrl, $params, $flags = 0) {
|
|
}
|
|
|
|
public static function onBeforePageDisplay(OutputPage $out) {
|
|
preg_match('/(<a href="\S*?\.(glb|gltf"))/',$out->getHTML(),$findGltf);
|
|
if ($findGltf[0]) {
|
|
$out->addModules('ext.glmv');
|
|
}
|
|
}
|
|
|
|
} |