parent
91a6b4de08
commit
b52595fe46
|
@ -6,4 +6,4 @@ DROP TABLE IF EXISTS media;
|
|||
DROP TABLE IF EXISTS video_metadata;
|
||||
DROP TABLE IF EXISTS media_exif;
|
||||
DROP TABLE IF EXISTS album;
|
||||
DROP TABLE IF EXISTS user;
|
||||
DROP TABLE IF EXISTS user;
|
||||
|
|
|
@ -66,6 +66,8 @@ CREATE TABLE IF NOT EXISTS media_exif (
|
|||
flash varchar(256),
|
||||
orientation int(1),
|
||||
exposure_program int(1),
|
||||
gps_latitude float,
|
||||
gps_longitude float,
|
||||
|
||||
PRIMARY KEY (exif_id)
|
||||
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
|
|
@ -18,6 +18,8 @@ type MediaEXIF struct {
|
|||
Flash *string
|
||||
Orientation *int
|
||||
ExposureProgram *int
|
||||
GPSLatitude *float64
|
||||
GPSLonitude *float64
|
||||
}
|
||||
|
||||
func (exif *MediaEXIF) Media() *Media {
|
||||
|
@ -31,7 +33,7 @@ func (exif *MediaEXIF) ID() int {
|
|||
func NewMediaExifFromRow(row *sql.Row) (*MediaEXIF, error) {
|
||||
exif := MediaEXIF{}
|
||||
|
||||
if err := row.Scan(&exif.ExifID, &exif.Camera, &exif.Maker, &exif.Lens, &exif.DateShot, &exif.Exposure, &exif.Aperture, &exif.Iso, &exif.FocalLength, &exif.Flash, &exif.Orientation, &exif.ExposureProgram); err != nil {
|
||||
if err := row.Scan(&exif.ExifID, &exif.Camera, &exif.Maker, &exif.Lens, &exif.DateShot, &exif.Exposure, &exif.Aperture, &exif.Iso, &exif.FocalLength, &exif.Flash, &exif.Orientation, &exif.ExposureProgram, &exif.GPSLatitude, &exif.GPSLonitude); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
|
@ -148,6 +148,15 @@ func ScanEXIF(tx *sql.Tx, media *models.Media) (returnExif *models.MediaEXIF, re
|
|||
exifValues = append(exifValues, *exposureProgram)
|
||||
}
|
||||
|
||||
lat, long, err := exifTags.LatLong()
|
||||
if err == nil {
|
||||
valueNames = append(valueNames, "gps_latitude")
|
||||
exifValues = append(exifValues, lat)
|
||||
|
||||
valueNames = append(valueNames, "gps_longitude")
|
||||
exifValues = append(exifValues, long)
|
||||
}
|
||||
|
||||
if len(valueNames) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue