storeuploads

package
v2.0.0-rc1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2018 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirProjects     = "projects"
	DirProjectImage = "projectimage"
	DirUsers        = "users"
	DirUserImage    = "userimage"
	DirUploads      = "uploads"

	FileProjectProfile = "image"
	FileProfilePicture = "image"

	PathGenericPlaceholderImage = "static/img/placeholder.svg"
	PathProfilePlaceholderImage = "static/img/profile-placeholder.png"
)

Variables

View Source
var ImageType = newImageTypeRegistry()

"Enum" for Image Types

Functions

func GetImagePath

func GetImagePath(pathInDataBase string, imageType string) string

GetImagePath will check if the stored image is present in the data directory. If the image can not be found the path of the placeholder will be returned.

func WriteProfilePictureToFile

func WriteProfilePictureToFile(imageSource string, user user.User) (string, error)

WriteProfilePictureToFile will write the profile image to file. The imageSource can either be a base64 encoded string or a relative path to an image. Only if the image is a base64 encoded string (which means the user uploaded a new image) then it will be written in the data/<username> directory for the project. If the image is a path, the user.Image property will be returned

func WriteProjectImageToFile

func WriteProjectImageToFile(imageSource string, project project.Project) (string, error)

WriteProjectImageToFile will write the project image to file. The imageSource can either be a base64 encoded string or a relative path to an image. Only if the image is a base64 encoded string (which means the user uploaded a new image) then it will be written in the data/<project name> directory for the project. If the image is a path, the project.Image property will be returned

func WriteUploadToFile

func WriteUploadToFile(filename string, fileSource string, project project.Project) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL