From ef063ce5cb1395ef4805e5faa3cceae758faba93 Mon Sep 17 00:00:00 2001 From: Oliver Tacke Date: Thu, 5 Apr 2018 17:17:56 +0200 Subject: [PATCH] HFP-1905 Fix image in "rights of use" view --- js/h5p.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/js/h5p.js b/js/h5p.js index d14001e..2f0ba32 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -164,7 +164,7 @@ H5P.init = function (target) { if (displayOptions.frame) { // Special handling of copyrights if (displayOptions.copyright) { - var copyrights = H5P.getCopyrights(instance, library.params, library.metadata, contentId); + var copyrights = H5P.getCopyrights(instance, library.params, contentId, library.metadata); if (!copyrights) { displayOptions.copyright = false; } @@ -982,12 +982,13 @@ H5P.Dialog = function (name, title, content, $element) { * Identifies the H5P content * @returns {string} Copyright information. */ -H5P.getCopyrights = function (instance, parameters, metadata, contentId) { +H5P.getCopyrights = function (instance, parameters, contentId, metadata) { var copyrights; if (instance.getCopyrights !== undefined) { try { // Use the instance's own copyright generator + console.log('getCopyrights() of', instance.libraryInfo.machineName); copyrights = instance.getCopyrights(); } catch (err) { @@ -1056,11 +1057,17 @@ H5P.findCopyrights = function (info, parameters, contentId) { if (value.metadata) { var metadataCopyrights = H5P.buildMetadataCopyrights(value.metadata, lastContentTypeName); if (metadataCopyrights !== undefined) { + if (value.params && value.params.contentName === 'Image' && value.params.file) { + var path = value.params.file.path; + var width = value.params.file.width; + var height = value.params.file.height; + metadataCopyrights.setThumbnail(new H5P.Thumbnail(H5P.getPath(path, contentId), width, height)); + } info.addMedia(metadataCopyrights); } } - // Check if object is a file with copyrights + // Check if object is a file with copyrights (old core) if (value.copyright === undefined || value.copyright.license === undefined || value.path === undefined ||