Collect metadata from glb file
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -42,9 +42,17 @@ class GlModelHooks {
|
||||
* @param OutputPage $out compiled page html and manipulation methods
|
||||
*/
|
||||
public static function onBeforePageDisplay($out) {
|
||||
preg_match('/(<model-viewer src="\S*?\.(glb|gltf"))/',$out->getHTML(),$findGltf);
|
||||
$file = MediaWikiServices::getInstance()->getRepoGroup()->findFile($out->getTitle());
|
||||
if ($file) {
|
||||
echo '<script>';
|
||||
self::console_log('Metadata:');
|
||||
self::console_log($file->getMetadata());
|
||||
echo '</script>';
|
||||
}
|
||||
preg_match('/(<model-viewer src="\S*?\.(glb|gltf"))/',$out->getHTML(),$findGltf);
|
||||
if ($findGltf[0]) {
|
||||
$out->addHeadItems(
|
||||
|
||||
$out->addHeadItems(
|
||||
Html::rawElement(
|
||||
'script',
|
||||
array(
|
||||
|
||||
Reference in New Issue
Block a user