diff --git a/pkg/components/media/model.go b/pkg/components/media/model.go
index f5c9ff6e725f7fc9bb25db01793b69835742e0ea..0e17e9231f4f7ded99d4d6fa6e866f34756a5514 100644
--- a/pkg/components/media/model.go
+++ b/pkg/components/media/model.go
@@ -15,6 +15,8 @@ MIMEType string
}
MediaEXIF struct {
+ Width *float64
+ Height *float64
Description *string
Camera *string
Maker *string
diff --git a/pkg/database/sql/media.go b/pkg/database/sql/media.go
index 59a4b83cd13b57b64e643a2b8a87f7f2c18fd9be..3446f792eabcf77cdae30b8f97500f15ddbd0900 100644
--- a/pkg/database/sql/media.go
+++ b/pkg/database/sql/media.go
@@ -21,6 +21,8 @@ }
MediaEXIF struct {
gorm.Model
+ Width *float64
+ Height *float64
MediaID uint
Media Media
Description *string
@@ -58,6 +60,8 @@ }
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 (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,
diff --git a/pkg/fileop/exif.go b/pkg/fileop/exif.go
index c2449adffc06db661a40e0519ab5d4ad3821f6db..79716ebe76df1d97bb717872cde6fe56095b7ffb 100644
--- a/pkg/fileop/exif.go
+++ b/pkg/fileop/exif.go
@@ -37,6 +37,17 @@ if err == nil {
newExif.Maker = &make
}
+ // Get Image Size
+ width, err := fileInfo.GetFloat("ImageWidth")
+ if err == nil {
+ newExif.Width = &width
+ }
+
+ height, err := fileInfo.GetFloat("ImageHeight")
+ if err == nil {
+ newExif.Height = &height
+ }
+
// Get lens
lens, err := fileInfo.GetString("LensModel")
if err == nil {