exif error handling, release action
All checks were successful
All checks were successful
This commit is contained in:
@ -101,11 +101,22 @@ class TemplateHelpers:
|
||||
if orientation in [5, 6, 7, 8]:
|
||||
width, height = height, width
|
||||
|
||||
exif = {
|
||||
ExifTags.TAGS[k]: v
|
||||
for k, v in img._getexif().items()
|
||||
if k in ExifTags.TAGS
|
||||
}
|
||||
exif = {}
|
||||
try:
|
||||
img = Image.open(file_path)
|
||||
exif_raw = img._getexif()
|
||||
if exif_raw:
|
||||
exif = {
|
||||
ExifTags.TAGS[k]: v
|
||||
for k, v in exif_raw.items()
|
||||
if k in ExifTags.TAGS
|
||||
}
|
||||
except Exception as e:
|
||||
print(f"Error processing image {file_path}: {e}")
|
||||
|
||||
date_taken = exif.get("DateTimeOriginal")
|
||||
if not date_taken:
|
||||
date_taken = format_date(file_path.stat().st_ctime)
|
||||
return ImageMetadata(
|
||||
width=width,
|
||||
height=height,
|
||||
|
Reference in New Issue
Block a user