imgmanager

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JpegSuffix = ".jpg"
	PngSuffix  = ".png"
	DngSuffix  = ".dng"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

type Image struct {
	Content io.ReadCloser
	Path    string
	Size    int64
	ImageMetadata
}

type ImageMetadata

type ImageMetadata struct {
	Model            string
	Datetime         string
	CreateDate       string
	DateTimeOriginal string
	ModifyDate       string
}

func GetImageMetadata

func GetImageMetadata(content []byte) (ImageMetadata, error)

type ImgManager

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

func NewImgManager

func NewImgManager(opt Option) *ImgManager

func (*ImgManager) DeleteImg

func (im *ImgManager) DeleteImg(paths []string)

func (*ImgManager) DeleteSingleImg

func (im *ImgManager) DeleteSingleImg(path string) error

func (*ImgManager) DeleteSingleImgAsync

func (im *ImgManager) DeleteSingleImgAsync(path string)

func (*ImgManager) Drive

func (im *ImgManager) Drive() StorageDrive

func (*ImgManager) GenerateThumbnail

func (im *ImgManager) GenerateThumbnail(path string, content []byte) error

func (*ImgManager) GenerateThumbnailAsync

func (im *ImgManager) GenerateThumbnailAsync(path string, content []byte)

func (*ImgManager) GetImg

func (im *ImgManager) GetImg(path string) (*Image, error)

func (*ImgManager) GetOffset

func (im *ImgManager) GetOffset(path string, offset int64) (*Image, error)

func (*ImgManager) GetThumbnail

func (im *ImgManager) GetThumbnail(path string) (*Image, error)

func (*ImgManager) RangeByDate

func (im *ImgManager) RangeByDate(date time.Time, f func(path string, size int64) bool) error

func (*ImgManager) SetDrive

func (im *ImgManager) SetDrive(dri StorageDrive)

func (*ImgManager) UploadImg

func (im *ImgManager) UploadImg(content, thumbnailContent io.Reader, contentSize, thumbnailSize int64, name string, date time.Time) error

func (*ImgManager) UploadImgAsync

func (im *ImgManager) UploadImgAsync(path string, content []byte, lastModified time.Time)

func (*ImgManager) UploadVideo

func (im *ImgManager) UploadVideo(content, thumbnailContent io.Reader, contentSize, thumbnailSize int64, name string, date time.Time) error

type Option

type Option struct {
	WorkerNum          int
	ThumbnailMaxWidth  int
	ThumbnailMaxHeight int
	ThumbbailQuality   int
}

type StorageDrive

type StorageDrive interface {
	Upload(string, io.ReadCloser, int64, time.Time) error
	// IsExist(path string) (bool, error)
	Download(path string) (io.ReadCloser, int64, error)
	DownloadWithOffset(path string, offset int64) (io.ReadCloser, int64, error)
	Delete(path string) error
	Range(dir string, deal func(fs.FileInfo) bool) error
}

type UnimplementedDrive

type UnimplementedDrive struct{}

func (*UnimplementedDrive) Delete

func (d *UnimplementedDrive) Delete(path string) error

func (*UnimplementedDrive) Download

func (d *UnimplementedDrive) Download(path string) (io.ReadCloser, int64, error)

func (*UnimplementedDrive) DownloadWithOffset

func (d *UnimplementedDrive) DownloadWithOffset(path string, offset int64) (io.ReadCloser, int64, error)

func (*UnimplementedDrive) IsExist

func (d *UnimplementedDrive) IsExist(path string) (bool, error)

func (*UnimplementedDrive) Range

func (d *UnimplementedDrive) Range(dir string, deal func(fs.FileInfo) bool) error

func (*UnimplementedDrive) Upload

func (d *UnimplementedDrive) Upload(_ string, _ io.ReadCloser, _ int64, _ time.Time) error

Jump to

Keyboard shortcuts

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