App for fetching and uploading images to cloud bucket storage

This commit is contained in:
2022-12-10 15:27:24 +01:00
commit b56c3d1e29
18 changed files with 749 additions and 0 deletions

24
image/image.go Normal file
View File

@@ -0,0 +1,24 @@
package image
import (
"github.com/kevinmidboe/planetposen-images/util"
)
// MessageImage is a representation of a single image in the database
type Image struct {
Path string `json:"path"`
URL string `json:"url,omitempty"`
}
// GetURL gets URL of the image, also in cases where MessageImage.URL is not defined.
func (mi *Image) GetURL(hostname string) string {
if mi.URL != "" {
return mi.URL
}
return util.ImageURL(hostname, mi.Path)
}
type PostImageData struct {
// PageTitle string
Filename string
}