config.StoragePath
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"axis_timelapse/config"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/rs/zerolog/log"
|
||||
@@ -21,8 +22,9 @@ func CaptureImage() bool {
|
||||
log.Error().Msg("Unexpected status code: " + strconv.Itoa(code))
|
||||
}
|
||||
|
||||
// Write the bytes to a file
|
||||
err1 := os.WriteFile("downloaded_image.jpg", body, 0644)
|
||||
timestamp := time.Now()
|
||||
filename := timestamp.Format("axis-2006-01-02_15-04-05.jpg")
|
||||
err1 := os.WriteFile(config.StoragePath+filename, body, 0644)
|
||||
if err1 != nil {
|
||||
log.Fatal().Err(err1).Msgf("")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user