cover

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package cover handles book cover storage All covers are stored as PNG, with names derived from book ID

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSStore

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

FSStore is an ImageStore which stores images on the filesystem

func New

func New(dataDir string) *FSStore

New FSstore with dataDir as root directory

func (*FSStore) GetCover

func (s *FSStore) GetCover(id string, w io.Writer) (written int64, err error)

GetCover retrieves the cover for book with given ID

func (*FSStore) GetThumbnail

func (s *FSStore) GetThumbnail(id string, w io.Writer) (written int64, err error)

GetThumbnail retrieves the thumbnail for book with given ID

func (*FSStore) SaveCover

func (s *FSStore) SaveCover(id string, img image.Image) error

SaveCover stores both book cover and thumbnail as PNG in data directory

type ImageStore

type ImageStore interface {
	SaveCover(id string, img image.Image) error
	GetCover(id string, w io.Writer) (written int64, err error)
	GetThumbnail(id string, w io.Writer) (written int64, err error)
}

ImageStore is a common interface to manipulate book covers. It covers (pun intended) saving/retrieving images and thumbnails

Jump to

Keyboard shortcuts

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