aboutsummaryrefslogtreecommitdiff
path: root/pkg/database/sql
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-06-25 20:45:43 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-06-25 20:45:43 +0200
commite1c8bb1bd5381d8ade3c699a2d6b4fb373112880 (patch)
tree924317fecd5f55c29c287d89dc5627bbbd73327c /pkg/database/sql
parent249ee195ce52ee4a4defeb67a33ef353919d3a11 (diff)
downloadlens-e1c8bb1bd5381d8ade3c699a2d6b4fb373112880.tar.gz
lens-e1c8bb1bd5381d8ade3c699a2d6b4fb373112880.tar.bz2
lens-e1c8bb1bd5381d8ade3c699a2d6b4fb373112880.zip
feat: Store image size
Add image dimensions to exif fetch.
Diffstat (limited to 'pkg/database/sql')
-rw-r--r--pkg/database/sql/media.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/database/sql/media.go b/pkg/database/sql/media.go
index 59a4b83..3446f79 100644
--- a/pkg/database/sql/media.go
+++ b/pkg/database/sql/media.go
@@ -21,6 +21,8 @@ type (
MediaEXIF struct {
gorm.Model
+ Width *float64
+ Height *float64
MediaID uint
Media Media
Description *string
@@ -58,6 +60,8 @@ func (self *Media) ToModel() *media.Media {
func (m *MediaEXIF) ToModel() *media.MediaEXIF {
return &media.MediaEXIF{
+ Height: m.Height,
+ Width: m.Width,
Description: m.Description,
Camera: m.Camera,
Maker: m.Maker,
@@ -188,6 +192,8 @@ func (m *MediaRepository) GetEXIF(ctx context.Context, mediaID uint) (*media.Med
func (s *MediaRepository) CreateEXIF(ctx context.Context, id uint, info *media.MediaEXIF) error {
media := &MediaEXIF{
MediaID: id,
+ Width: info.Width,
+ Height: info.Height,
Description: info.Description,
Camera: info.Camera,
Maker: info.Maker,