From 6053d3b7252fac5c428abb6b8cfea77b7ec241d1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 23 Jan 2023 14:35:54 +0000 Subject: [PATCH] Add creator details to images, if available --- webapp_utils.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/webapp_utils.py b/webapp_utils.py index 4300c7db0..43f41f96e 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -1233,6 +1233,12 @@ def get_post_attachments_as_html(base_dir: str, for attach in post_json_object['object']['attachment']: if not (attach.get('mediaType') and attach.get('url')): continue + media_license = '' + if attach.get('schema:license'): + media_license = attach['schema:license'] + media_creator = '' + if attach.get('schema:creator'): + media_creator = attach['schema:creator'] media_type = attach['mediaType'] image_description = '' @@ -1337,11 +1343,24 @@ def get_post_attachments_as_html(base_dir: str, '
\n' attachment_str += '' + if media_license or media_creator: + attachment_str += '
' attachment_str += \ '' + image_description + '\n' + if media_license or media_creator: + attachment_str += '
' + license_str = '' + if media_license: + license_str += '©' + if media_creator: + if license_str: + license_str += ' ' + license_str += media_creator + if media_license or media_creator: + attachment_str += license_str + '
' if minimize_images: attachment_str += '
\n'