image

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedImageFormat = errors.New("unsupported image format")

	// ErrNotSupportedForThumbnail is returned if the image format is not supported for thumbnail generation
	ErrNotSupportedForThumbnail = errors.New("unsupported image format for thumbnail")
)

Functions

func AddPerformer added in v0.7.0

func AddPerformer(qb models.ImageReaderWriter, id int, performerID int) (bool, error)

func AddTag added in v0.7.0

func AddTag(qb models.ImageReaderWriter, id int, tagID int) (bool, error)

func CalculateMD5

func CalculateMD5(path string) (string, error)

func CountByPerformerID added in v0.7.0

func CountByPerformerID(r models.ImageReader, id int) (int, error)

func CountByStudioID added in v0.7.0

func CountByStudioID(r models.ImageReader, id int) (int, error)

func CountByTagID added in v0.7.0

func CountByTagID(r models.ImageReader, id int) (int, error)

func DecodeSourceImage added in v0.10.0

func DecodeSourceImage(i *models.Image) (*image.Config, *string, error)

func Destroy added in v0.12.0

func Destroy(i *models.Image, destroyer Destroyer, fileDeleter *FileDeleter, deleteGenerated, deleteFile bool) error

Destroy destroys an image, optionally marking the file and generated files for deletion.

func FileExists

func FileExists(path string) bool

func FileScanner added in v0.11.0

func FileScanner(hasher file.Hasher) file.Scanner

func FindByGalleryID added in v0.14.0

func FindByGalleryID(r models.ImageReader, galleryID int, sortBy string, sortDir models.SortDirectionEnum) ([]*models.Image, error)

func GetFileDetails

func GetFileDetails(path string) (*models.Image, error)

GetFileDetails returns a pointer to an Image object with the width, height and size populated.

func GetFileModTime

func GetFileModTime(path string) (time.Time, error)

GetFileModTime gets the file modification time, handling files in zip files.

func GetFilename added in v0.7.0

func GetFilename(s *models.Image, stripExt bool) string

GetFilename gets the base name of the image file If stripExt is set the file extension is omitted from the name

func GetSourceImage

func GetSourceImage(i *models.Image) (image.Image, error)

func GetStudioName

func GetStudioName(reader models.StudioReader, image *models.Image) (string, error)

GetStudioName returns the name of the provided image's studio. It returns an empty string if there is no studio assigned to the image.

func GetTitle

func GetTitle(s *models.Image) string

func GetVipsPath added in v0.10.0

func GetVipsPath() string

func IsCover

func IsCover(img *models.Image) bool

func PathsFilter added in v0.12.0

func PathsFilter(paths []string) *models.ImageFilterType

func Query added in v0.11.0

func Query(qb Queryer, imageFilter *models.ImageFilterType, findFilter *models.FindFilterType) ([]*models.Image, error)

Query queries for images using the provided filters.

func QueryOptions added in v0.11.0

func QueryOptions(imageFilter *models.ImageFilterType, findFilter *models.FindFilterType, count bool) models.ImageQueryOptions

QueryOptions returns a ImageQueryResult populated with the provided filters.

func Serve

func Serve(w http.ResponseWriter, r *http.Request, path string)

func SetFileDetails

func SetFileDetails(i *models.Image) error

func ToBasicJSON

func ToBasicJSON(image *models.Image) *jsonschema.Image

ToBasicJSON converts a image object into its JSON object equivalent. It does not convert the relationships to other objects, with the exception of cover image.

func UpdateFileModTime added in v0.5.0

func UpdateFileModTime(qb models.ImageWriter, id int, modTime models.NullSQLiteTimestamp) (*models.Image, error)

Types

type Destroyer added in v0.12.0

type Destroyer interface {
	Destroy(id int) error
}

type FileDeleter added in v0.12.0

type FileDeleter struct {
	file.Deleter

	Paths *paths.Paths
}

FileDeleter is an extension of file.Deleter that handles deletion of image files.

func (*FileDeleter) MarkGeneratedFiles added in v0.12.0

func (d *FileDeleter) MarkGeneratedFiles(image *models.Image) error

MarkGeneratedFiles marks for deletion the generated files for the provided image.

type Importer

type Importer struct {
	ReaderWriter        models.ImageReaderWriter
	StudioWriter        models.StudioReaderWriter
	GalleryWriter       models.GalleryReaderWriter
	PerformerWriter     models.PerformerReaderWriter
	TagWriter           models.TagReaderWriter
	Input               jsonschema.Image
	Path                string
	MissingRefBehaviour models.ImportMissingRefEnum

	ID int
	// contains filtered or unexported fields
}

func (*Importer) Create

func (i *Importer) Create() (*int, error)

func (*Importer) FindExistingID

func (i *Importer) FindExistingID() (*int, error)

func (*Importer) Name

func (i *Importer) Name() string

func (*Importer) PostImport

func (i *Importer) PostImport(id int) error

func (*Importer) PreImport

func (i *Importer) PreImport() error

func (*Importer) Update

func (i *Importer) Update(id int) error

type Queryer added in v0.11.0

type Queryer interface {
	Query(options models.ImageQueryOptions) (*models.ImageQueryResult, error)
}

type Scanner added in v0.11.0

type Scanner struct {
	file.Scanner

	StripFileExtension bool

	CaseSensitiveFs bool
	TxnManager      models.TransactionManager
	Paths           *paths.Paths
	PluginCache     *plugin.Cache
	MutexManager    *utils.MutexManager
}

func (*Scanner) ScanExisting added in v0.11.0

func (scanner *Scanner) ScanExisting(ctx context.Context, existing file.FileBased, file file.SourceFile) (retImage *models.Image, err error)

func (*Scanner) ScanNew added in v0.11.0

func (scanner *Scanner) ScanNew(ctx context.Context, f file.SourceFile) (retImage *models.Image, err error)

type ThumbnailEncoder added in v0.10.0

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

func NewThumbnailEncoder added in v0.10.0

func NewThumbnailEncoder(ffmpegEncoder ffmpeg.FFMpeg) ThumbnailEncoder

func (*ThumbnailEncoder) GetThumbnail added in v0.10.0

func (e *ThumbnailEncoder) GetThumbnail(img *models.Image, maxSize int) ([]byte, error)

GetThumbnail returns the thumbnail image of the provided image resized to the provided max size. It resizes based on the largest X/Y direction. It returns nil and an error if an error occurs reading, decoding or encoding the image, or if the image is not suitable for thumbnails.

Jump to

Keyboard shortcuts

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