Documentation ¶
Index ¶
Constants ¶
View Source
const ( FileKind int = iota ImageKind )
Variables ¶
This section is empty.
Functions ¶
func GetImagesForContent ¶
GetImagesForContent fetches images for the provided content which are located in the Content.Images attribute only.
func RemoveFile ¶
func RemoveFile(col *mgo.Collection, idStr string, filesDir string) error
RemoveFile deletes a file from a file system and a database.
func UploadFromForm ¶
func UploadFromForm(col *mgo.Collection, fh *multipart.FileHeader, outputDir, caption, credits string, optimize bool) error
UploadFromForm dumps a file to a file system and upserts into a mongo database.
Types ¶
type File ¶
type File struct { ID bson.ObjectId `bson:"_id"` Title string // Credits field contains information about a file source or a name of an author. Credits string Kind int URL string Size int64 Created time.Time // Optimized can contain several URLs to optimized versions of a file from // the original File.URL field. Usually, it is used for images to store several // formats and sizes of them. Optimized []*OptimizedImage }
File is used for file uploads.
func AllFiles ¶
func AllFiles(col *mgo.Collection, query interface{}) ([]*File, error)
AllFiles returns files from a database.
func AllFilesByPage ¶
func AllFilesByPage(col *mgo.Collection, query interface{}, perpage, page int) (items []*File, prev, next, total int, err error)
AllFilesByPage returns files by page.
type OptimizedImage ¶
Click to show internal directories.
Click to hide internal directories.