Documentation ¶
Index ¶
- func CalculateElo(elo1, elo2 float64) float64
- func ConvertToJPEG(w io.Writer, r io.Reader) error
- func Errconv(err error) string
- func GenerateAPIKey() string
- func IsValidUUID(u string) bool
- func Split(input string) []string
- func ValidateKey(key string) bool
- type Credentials
- type Image
- func (i Image) BlurHashing(img image.Image) string
- func (i Image) FileSize(buf bytes.Buffer) int64
- func (i Image) FindHeight(img image.Image) int
- func (i Image) FindWidth(img image.Image) int
- func (i Image) HashSet(img image.Image) images4.IconT
- func (i *Image) NewUUID() string
- func (i Image) ScaleDown(img image.Image) image.Image
- func (i *Image) SetTime() string
- func (i Image) Validate(image Image) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateElo ¶
func ConvertToJPEG ¶
Accepts formats of webp, png, jpeg and gif
func Split ¶
Input r.Form.Get("Tags") Splits a single string into an array of lowercase letters without any whitespace
func ValidateKey ¶
Initial validation to deter keys with wrong format
Types ¶
type Credentials ¶
type Credentials struct { Username string `json:"username" bson:"username"` Passwordhash string `json:"passwordhash" bson:"passwordhash"` Uuid string `json:"uuid" bson:"uuid"` Key string `json:"key" bson:"key"` Created_At string `json:"created_at" bson:"created_at"` OwnedImages []string `json:"owned_images" bson:"owned_images"` }
func (*Credentials) CompareHash ¶
func (c *Credentials) CompareHash(storedpassword string, password string) bool
Compares password from mongodb with input password
func (*Credentials) Hash ¶
func (c *Credentials) Hash(password string) string
func (Credentials) Validate ¶
func (c Credentials) Validate(crreds Credentials) error
Simple validation againt the credentials struct that checks if username, password and key are empty strings
type Image ¶
type Image struct { Title string `json:"title" bson:"title"` Uuid string `json:"uuid" bson:"uuid"` Tags []string `json:"tags" bson:"tags"` Created_At string `json:"created_at" bson:"created_at"` Filepath string `json:"filepath" bson:"filepath"` Filesize int64 `json:"filesize" bson:"filesize"` Width int `json:"width" bson:"width"` Height int `json:"height" bson:"height"` BlurHash string `json:"blurhash" bson:"blurhash"` Hash images4.IconT `json:"-" bson:"hash"` Elo float64 `json:"elo" bson:"elo"` Owner string `json:"owner" bson:"owner"` }
func (Image) BlurHashing ¶
returns the blurhash of an image
Click to show internal directories.
Click to hide internal directories.