Skip to content

Commit

Permalink
✨ Save EXIF into file metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleSheep2Code committed Oct 16, 2024
1 parent 6d57ce8 commit 831717f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 3 additions & 8 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pkg/internal/services/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func AnalyzeAttachment(file models.Attachment) error {
"width": width,
"height": height,
"ratio": ratio,
"exif": map[string]any{},
}

// Removing location EXIF data
Expand All @@ -160,6 +161,8 @@ func AnalyzeAttachment(file models.Attachment) error {
for k, _ := range data.Fields {
if strings.HasPrefix(k, "GPS") {
data.Clear(k)
} else {
file.Metadata["exif"].(map[string]any)[k] = data.Fields[k]
}
}
}
Expand All @@ -186,6 +189,7 @@ func AnalyzeAttachment(file models.Attachment) error {
"codec_name": stream.CodecName,
"color_range": stream.ColorRange,
"color_space": stream.ColorSpace,
"exif": map[string]any{},
}

// Removing location EXIF data
Expand All @@ -199,6 +203,8 @@ func AnalyzeAttachment(file models.Attachment) error {
for k, _ := range data.Fields {
if strings.HasPrefix(k, "GPS") {
data.Clear(k)
} else {
file.Metadata["exif"].(map[string]any)[k] = data.Fields[k]
}
}
}
Expand Down

0 comments on commit 831717f

Please sign in to comment.