1
Fork 0
photoview/api/scanner/process_image.go

16 lines
312 B
Go
Raw Normal View History

2020-02-02 00:29:42 +01:00
package scanner
import (
"database/sql"
"path"
)
func ProcessImage(tx *sql.Tx, photoPath string, albumId int) error {
photoName := path.Base(photoPath)
_, err := tx.Exec("INSERT IGNORE INTO photo (title, path, album_id) VALUES (?, ?, ?)", photoName, photoPath, albumId)
if err != nil {
return err
}
}