exif error handling, release action
All checks were successful
Datadog Software Composition Analysis / Datadog SBOM Generation and Upload (push) Successful in 24s
Datadog Secrets Scanning / Datadog Static Analyzer (push) Successful in 39s
Datadog Static Analysis / Datadog Static Analyzer (push) Successful in 25s

This commit is contained in:
Tanishq Dubey 2025-03-14 22:31:12 -04:00
parent 1fc99dd2ce
commit fa46d82874
2 changed files with 45 additions and 5 deletions

View File

@ -0,0 +1,29 @@
name: Release
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/foldsite:${{ github.ref_name }}

View File

@ -101,11 +101,22 @@ class TemplateHelpers:
if orientation in [5, 6, 7, 8]: if orientation in [5, 6, 7, 8]:
width, height = height, width width, height = height, width
exif = {}
try:
img = Image.open(file_path)
exif_raw = img._getexif()
if exif_raw:
exif = { exif = {
ExifTags.TAGS[k]: v ExifTags.TAGS[k]: v
for k, v in img._getexif().items() for k, v in exif_raw.items()
if k in ExifTags.TAGS 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( return ImageMetadata(
width=width, width=width,
height=height, height=height,