Skip to content

Commit

Permalink
Merge pull request #6 from VoycerAG/inherit_metadata
Browse files Browse the repository at this point in the history
Enable inheritance of metadata.
  • Loading branch information
Robert Gruber committed Jun 19, 2015
2 parents 5fa3ace + 5b439f2 commit 120cf49
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ func addImageMetaData(targetImage *mgo.GridFile, imageData image.Image, imageFor
"resizeType": entry.Type,
"size": fmt.Sprintf("%dx%d", entry.Width, entry.Height)}

originalMetadata := bson.M{}

if err := originalImage.GetMeta(&originalMetadata); err != nil {
log.Println("Original image data not found.")
} else {
for k, v := range originalMetadata {
if _, exists := metadata[k]; !exists {
metadata[k] = v
}
}
}

targetImage.SetContentType(fmt.Sprintf("image/%s", imageFormat))
targetImage.SetMeta(metadata)
}
Expand Down

0 comments on commit 120cf49

Please sign in to comment.