2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-19 10:47:07 +00:00

year fixed if not in exif data

This commit is contained in:
2025-03-08 07:09:50 +00:00
parent ec3f513308
commit 9a4916cc58

View File

@@ -295,7 +295,7 @@ def new_image_form(request, path):
if form.is_valid(): if form.is_valid():
# print(f"new_image_form(): form is valid ") # print(f"new_image_form(): form is valid ")
year = form.cleaned_data["year"] fyear = form.cleaned_data["year"]
descrip = form.cleaned_data["description"] descrip = form.cleaned_data["description"]
editor = form.cleaned_data["who_are_you"] editor = form.cleaned_data["who_are_you"]
editor = git_string(editor) editor = git_string(editor)
@@ -326,10 +326,10 @@ def new_image_form(request, path):
# date and time from exif data # date and time from exif data
if 36867 in exif_dict['Exif'] and 36880 in exif_dict['Exif']: if 36867 in exif_dict['Exif'] and 36880 in exif_dict['Exif']:
descrip += f"\n\n{exif_dict['Exif'][36867].decode()} {exif_dict['Exif'][36880].decode()}" descrip += f"\n\n{exif_dict['Exif'][36867].decode()} {exif_dict['Exif'][36880].decode()}"
if not year: year = exif_dict['Exif'][36867].decode()[:4]
year = exif_dict['Exif'][36867].decode()[:4] else:
year = fyear # replace with year from photo exif if possible
else: else:
year = current_expo() # replace with year from photo exif if possible
exif = None exif = None
width, height = i.size width, height = i.size