Added exiftool and function to remove GPS data from EXIF
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
FROM alpine:3.21
|
FROM alpine:3.21
|
||||||
|
|
||||||
RUN apk add curl python3
|
RUN apk add curl python3 exiftool
|
||||||
RUN adduser -D kakigoori
|
RUN adduser -D kakigoori
|
||||||
|
|
||||||
USER kakigoori
|
USER kakigoori
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
import subprocess
|
||||||
|
|
||||||
import boto3
|
import boto3
|
||||||
from botocore.config import Config
|
from botocore.config import Config
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@@ -15,3 +17,14 @@ def get_b2_resource():
|
|||||||
bucket = b2.Bucket(settings.S3_BUCKET)
|
bucket = b2.Bucket(settings.S3_BUCKET)
|
||||||
|
|
||||||
return bucket
|
return bucket
|
||||||
|
|
||||||
|
|
||||||
|
def remove_exif_gps_data(image_data: bytes) -> bytes:
|
||||||
|
result = subprocess.run(
|
||||||
|
["exiftool", "-gps:all=", "-"], input=image_data, capture_output=True
|
||||||
|
)
|
||||||
|
|
||||||
|
if not result.check_returncode():
|
||||||
|
return image_data
|
||||||
|
else:
|
||||||
|
raise Exception(result.stderr)
|
||||||
|
Reference in New Issue
Block a user