model

package
v0.0.0-...-a352b82 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2015 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//MinFile minimum File Size
	MinFile = 1 // bytes
	// MaxFileSize file size is memcache limit (1MB) minus key size minus overhead:
	MaxFileSize = 244999000 // bytes
	//ImageType regxp accepted type
	ImageType = "((gif|p?jpeg|(x-)?png))"
	//AcceptFileTypes accepted files
	AcceptFileTypes = ImageType
	//ThumbMaxWidth max size
	ThumbMaxWidth = 200

	//ThumbMaxHeight max height
	ThumbMaxHeight = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Media

type Media struct {
	Name          string `bson:"name" json:"name"`
	Path          string `bson:"path" json:"-"`
	ThumbnailPath string `bson:"thumbnailPath" json:"-"`
	MimeType      string `bson:"mimetype" json:"mimetype"`
	URL           string `bson:"url" json:"url,omitempty"`
	ThumbnailURL  string `bson:"thumbnailUrl" json:"thumbnailUrl,omitempty"`
	Size          int64  `bson:"size" json:"size"`
	// contains filtered or unexported fields
}

Media Represent a media file

func NewMedia

func NewMedia(inputFile io.Reader, filename, filePath, url string) (*Media, error)

NewMedia Create a new Media ptr

func (*Media) ValidateSize

func (media *Media) ValidateSize(n int64) (bool, error)

ValidateSize check the size

func (*Media) ValidateType

func (media *Media) ValidateType(typeMime string) (bool, error)

ValidateType check type of media

func (*Media) Write

func (media *Media) Write(p []byte) (int, error)

func (*Media) WriteImages

func (media *Media) WriteImages(input io.Reader) error

WriteImages writes Images to filesystem normal and thumbnail

Jump to

Keyboard shortcuts

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