From d559e786d1674fe476d71b2e1e448544b3a94720 Mon Sep 17 00:00:00 2001 From: Justin Georgi Date: Mon, 11 Nov 2024 20:55:07 -0700 Subject: [PATCH] Display metadata on file page Signed-off-by: Justin Georgi --- i18n/en.json | 3 ++- includes/GlModelHandler.php | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index 06dd8b7..13a4e8c 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -2,5 +2,6 @@ "exif-glmv-meshes": "Number of meshes", "exif-glmv-textures": "Number of textures", "exif-glmv-version": "GLTF version", - "exif-glmv-generator": "Model generator" + "exif-glmv-generator": "Model generator", + "exif-glmv-metadata": "GLMV metadata version" } \ No newline at end of file diff --git a/includes/GlModelHandler.php b/includes/GlModelHandler.php index ebc1096..6243498 100644 --- a/includes/GlModelHandler.php +++ b/includes/GlModelHandler.php @@ -198,7 +198,7 @@ class GlModelHandler extends ImageHandler { } $newMeta['glmv-metadata'] = self::GLMV_VERSION; $metaHandler = new BitmapMetadataHandler; - $metaHandler->addMetadata($newMeta,'exif'); + $metaHandler->addMetadata($newMeta,'native'); return array( 'width' => 600, 'height' => 800, @@ -225,6 +225,26 @@ class GlModelHandler extends ImageHandler { return self::METADATA_GOOD; } + /** + * Get an array structure that the UI will format this into a table where the visible + * fields are always visible, and the collapsed fields are optionally visible. + * + * The function should return false if there is no metadata to display. + * + * @param File $image + * @param bool|IContextSource $context Context to use (optional) + * @return bool|array + */ + public function formatMetadata( $image, $context = false ) { + $glmvMetadata = $image->getMetadataArray(); + + if (!count( $glmvMetadata ) ) { + return false; + } else { + return $this->formatMetadataHelper( $glmvMetadata, $context ); + } + } + /** * Small helper function to display information on the browser console *