Documentation ¶
Index ¶
- type FileSpec
- func (ms *FileSpec) AspectRatio() float64
- func (ms *FileSpec) CacheDir() string
- func (ms *FileSpec) CacheFilename() string
- func (ms *FileSpec) CacheHeight() int
- func (ms *FileSpec) CachePath() string
- func (ms *FileSpec) CacheWidth() int
- func (ms *FileSpec) MimeCategory() string
- func (ms *FileSpec) Resize() bool
- type MediaServer
- func (ms MediaServer) Delete(filename string) error
- func (ms MediaServer) FileSpec(file *url.URL, defaultType string) FileSpec
- func (ms MediaServer) Get(filespec FileSpec, destination io.Writer) error
- func (ms MediaServer) Process(file afero.File, filespec FileSpec) (io.Reader, error)
- func (ms MediaServer) Put(filename string, file io.Reader) (int, int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSpec ¶
FileSpec represents all the parameters available for requesting a file. This can be generated directly from a URL.
func NewFileSpec ¶
NewFileSpec reads a URL and returns a fully populated FileSpec
func (*FileSpec) AspectRatio ¶ added in v0.11.0
func (*FileSpec) CacheDir ¶
CacheDir returns the name of the directory within the cache where versions of this file will be stored.
func (*FileSpec) CacheFilename ¶
CacheFilename returns the filename to be used when retrieving this from the FileSpec cache.
func (*FileSpec) CacheHeight ¶
CacheHeight returns the height of the file to save in the cache
func (*FileSpec) CachePath ¶
CachePath returns the complete path (within the cache directory) to the file requested by this FileSpec
func (*FileSpec) CacheWidth ¶
CacheWidth returns the width of the file to save in the cache
func (*FileSpec) MimeCategory ¶
MimeCategory returns the first half of the mime type
type MediaServer ¶
type MediaServer struct {
// contains filtered or unexported fields
}
MediaServer manages files on a filesystem and performs image processing when requested.
func New ¶
func New(original afero.Fs, cache afero.Fs) MediaServer
New returns a fully initialized MediaServer
func (MediaServer) Delete ¶
func (ms MediaServer) Delete(filename string) error
Delete completely removes a file from the MediaServer along with any cached files.
func (MediaServer) FileSpec ¶
func (ms MediaServer) FileSpec(file *url.URL, defaultType string) FileSpec
FileSpec returns a new FileSpec for the provided URL
func (MediaServer) Get ¶
func (ms MediaServer) Get(filespec FileSpec, destination io.Writer) error
Get locates the file, processes it if necessary, and returns it to the caller.