exif error handling, release action
All checks were successful
All checks were successful
This commit is contained in:
parent
1fc99dd2ce
commit
fa46d82874
29
.gitea/workflows/release.yml
Normal file
29
.gitea/workflows/release.yml
Normal 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 }}
|
@ -101,11 +101,22 @@ class TemplateHelpers:
|
||||
if orientation in [5, 6, 7, 8]:
|
||||
width, height = height, width
|
||||
|
||||
exif = {}
|
||||
try:
|
||||
img = Image.open(file_path)
|
||||
exif_raw = img._getexif()
|
||||
if exif_raw:
|
||||
exif = {
|
||||
ExifTags.TAGS[k]: v
|
||||
for k, v in img._getexif().items()
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user