imglib

package
v0.0.0-...-fef8d01 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DBFilename = ".library.db"

The Sqlite filename within the library directory

View Source
var DefaultImageConfiguration = ImageConfiguration{
	ThumbMaxSize: 300,
	LargeMaxSize: 1200,
	JpegQuality:  95,
}
View Source
var WriteTestFilename = ".galleryWriteTest"

Functions

This section is empty.

Types

type Image

type Image struct {
	ID            uint       `gorm:"primary_key"`
	UserID        uint       `sql:"index"`
	User          User       `json:"user"`
	Tags          string     `json:"tags"`
	LargeFilename string     `json:"src"`
	LargeW        int        `json:"w"`
	LargeH        int        `json:"h"`
	ThumbFilename string     `json:"msrc"`
	ThumbW        int        `json:"mw"`
	ThumbH        int        `json:"mh"`
	CreatedAt     time.Time  `json:"-"`
	UpdatedAt     time.Time  `json:"-"`
	DeletedAt     *time.Time `json:"-"`
}

func (*Image) DeleteFromDirectory

func (img *Image) DeleteFromDirectory(directoryPath string) (error, error)

func (*Image) SaveToDirectory

func (img *Image) SaveToDirectory(dir string, imageStream io.Reader, imgCfg ImageConfiguration) error

type ImageConfiguration

type ImageConfiguration struct {
	ThumbMaxSize int
	LargeMaxSize int
	JpegQuality  int
}

type ImageLibrary

type ImageLibrary struct {
	// contains filtered or unexported fields
}

func (*ImageLibrary) Close

func (lib *ImageLibrary) Close() (err error)

func (*ImageLibrary) CreateImage

func (lib *ImageLibrary) CreateImage(user User, imageStream io.Reader) (*Image, error)

func (*ImageLibrary) CreateUser

func (lib *ImageLibrary) CreateUser(user *User) error

func (*ImageLibrary) DeleteImage

func (lib *ImageLibrary) DeleteImage(userid, imageid uint) error

func (*ImageLibrary) GetImages

func (lib *ImageLibrary) GetImages(offset, limit int) ([]*Image, error)

func (*ImageLibrary) GetImagesByUsername

func (lib *ImageLibrary) GetImagesByUsername(username string) ([]*Image, error)

func (*ImageLibrary) Open

func (lib *ImageLibrary) Open(directoryPath string) error

Opens the library denoted by the given directory. If the directory does not exist, it will be created.

func (*ImageLibrary) SaveUser

func (lib *ImageLibrary) SaveUser(user *User) error

func (*ImageLibrary) UserByUsername

func (lib *ImageLibrary) UserByUsername(username string) (*User, error)

type User

type User struct {
	ID        uint       `gorm:"primary_key"`
	UserName  string     `sql:"type:varchar(50);unique_index"json:"userName"`
	NickName  string     `sql:"type:varchar(50)"json:"nickName"`
	Link      string     `sql:"type:varchar(500)"json:"link"`
	CreatedAt time.Time  `json:"-"`
	UpdatedAt time.Time  `json:"-"`
	DeletedAt *time.Time `json:"-"`
}

Jump to

Keyboard shortcuts

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