Implement proper photo rotation based on exif data

This commit is contained in:
viktorstrate
2020-03-12 12:30:55 +01:00
parent a65a7bc289
commit 179ec5283b
7 changed files with 106 additions and 29 deletions

View File

@@ -1,10 +1,11 @@
package utils
import "crypto/rand"
import "math/big"
import "log"
import (
"crypto/rand"
"fmt"
"log"
"math/big"
)
func GenerateToken() string {
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
@@ -23,3 +24,20 @@ func GenerateToken() string {
}
return string(b)
}
type PhotoviewError struct {
message string
original error
}
func (e PhotoviewError) Error() string {
return fmt.Sprintf("%s: %s", e.message, e.original)
}
func HandleError(message string, err error) PhotoviewError {
log.Printf("ERROR: %s: %s", message, err)
return PhotoviewError{
message: message,
original: err,
}
}