Add license and creator to media timeline images

main
Bob Mottram 2023-01-23 17:11:27 +00:00
parent 7daa8812aa
commit dcb5fcf4c0
1 changed files with 19 additions and 0 deletions

View File

@ -1284,11 +1284,30 @@ def get_post_attachments_as_html(base_dir: str,
gallery_str += '<div class="gallery">\n' gallery_str += '<div class="gallery">\n'
if not is_muted: if not is_muted:
gallery_str += ' <a href="' + image_url + '">\n' gallery_str += ' <a href="' + image_url + '">\n'
if media_license or media_creator:
gallery_str += ' <figure>\n'
gallery_str += \ gallery_str += \
' <img loading="lazy" ' + \ ' <img loading="lazy" ' + \
'decoding="async" src="' + \ 'decoding="async" src="' + \
image_url + '" alt="" title="">\n' image_url + '" alt="" title="">\n'
gallery_str += ' </a>\n' gallery_str += ' </a>\n'
license_str = ''
if media_license:
if '://' in media_license:
license_str += \
'<a href="' + media_license + \
'" target="_blank" ' + \
'rel="nofollow noopener noreferrer">©</a>'
else:
license_str += media_license
if media_creator:
if license_str:
license_str += ' '
license_str += media_creator
if media_license or media_creator:
gallery_str += \
' ' + license_str + \
'</figcaption></figure>\n'
if post_json_object['object'].get('url'): if post_json_object['object'].get('url'):
image_post_url = post_json_object['object']['url'] image_post_url = post_json_object['object']['url']
else: else: