mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 21:09:05 +00:00
Adding image description to sidebar
This commit is contained in:
@@ -81,6 +81,13 @@ func (p *externalExifParser) ParseExif(media_path string) (returnExif *models.Me
|
||||
newExif := models.MediaEXIF{}
|
||||
found_exif := false
|
||||
|
||||
// Get description
|
||||
description, err := fileInfo.GetString("ImageDescription")
|
||||
if err == nil {
|
||||
found_exif = true
|
||||
newExif.Description = &description
|
||||
}
|
||||
|
||||
// Get camera model
|
||||
model, err := fileInfo.GetString("Model")
|
||||
if err == nil {
|
||||
|
||||
@@ -44,6 +44,11 @@ func (p internalExifParser) ParseExif(media_path string) (returnExif *models.Med
|
||||
|
||||
newExif := models.MediaEXIF{}
|
||||
|
||||
description, err := p.readStringTag(exifTags, exif.ImageDescription, media_path)
|
||||
if err == nil {
|
||||
newExif.Description = description
|
||||
}
|
||||
|
||||
model, err := p.readStringTag(exifTags, exif.Model, media_path)
|
||||
if err == nil {
|
||||
newExif.Camera = model
|
||||
|
||||
@@ -48,6 +48,7 @@ func TestExifParsers(t *testing.T) {
|
||||
{
|
||||
path: "./test_data/bird.jpg",
|
||||
assert: func(t *testing.T, exif *models.MediaEXIF) {
|
||||
assert.EqualValues(t, *exif.Description, "Photo of a Bird")
|
||||
assert.WithinDuration(t, *exif.DateShot, time.Unix(1336318784, 0).UTC(), time.Minute)
|
||||
assert.EqualValues(t, *exif.Camera, "Canon EOS 600D")
|
||||
assert.EqualValues(t, *exif.Maker, "Canon")
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Reference in New Issue
Block a user