16 lines
312 B
Go
16 lines
312 B
Go
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
|
|
}
|
|
}
|