Documentation ¶
Overview ¶
Package imageserver provides an Image server toolkit.
Index ¶
- Constants
- type Handler
- type HandlerFunc
- type HandlerServer
- type Image
- type ImageError
- type ParamError
- type Params
- func (params Params) Copy() Params
- func (params Params) Empty() bool
- func (params Params) Get(key string) (any, error)
- func (params Params) GetBool(key string) (bool, error)
- func (params Params) GetFloat(key string) (float64, error)
- func (params Params) GetInt(key string) (int, error)
- func (params Params) GetInt64(key string) (int64, error)
- func (params Params) GetParams(key string) (Params, error)
- func (params Params) GetString(key string) (string, error)
- func (params Params) Has(key string) bool
- func (params Params) Keys() []string
- func (params Params) Len() int
- func (params Params) Set(key string, value any)
- func (params Params) String() string
- type Server
- type ServerFunc
Constants ¶
const ( // ImageFormatMaxLen is the maximum length for the Image's format. ImageFormatMaxLen = 1 << 8 // 256 B // ImageDataMaxLen is the maximum length for the Image's data. ImageDataMaxLen = 1 << 30 // 1 GiB )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
HandlerFunc is a Handler func.
type HandlerServer ¶
HandlerServer is a Server implementation that calls a Handler.
type Image ¶
type Image struct { // Format is the format used to encode the image. // // e.g. png, jpeg, bmp, gif, ... Format string // Data contains the raw data of the encoded image. Data []byte }
Image is a raw image.
Binary encoding:
- Format length (uint32)
- Format (string)
- Data length (uint32)
- Data([]byte)
Numbers are encoded using little-endian order.
func (*Image) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler.
func (*Image) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler.
It copies data then call UnmarshalBinaryNoCopy().
func (*Image) UnmarshalBinaryNoCopy ¶
UnmarshalBinaryNoCopy is like encoding.BinaryUnmarshaler but does no copy.
The caller must not reuse data after that.
type ImageError ¶
type ImageError struct {
Message string
}
ImageError is an Image error.
func (*ImageError) Error ¶
func (err *ImageError) Error() string
type ParamError ¶
ParamError is an error for a param.
func (*ParamError) Error ¶
func (err *ParamError) Error() string
type Params ¶
Params are params used in imageserver.
This is a wrapper around map[string]any and provides utility methods. It should only contains basic Go types values (string, int float64, ...) or nested Params.
Getter methods return a *ParamError if the key does not exist or the type does not match.
type Server ¶
Server serves an Image.
func NewLimitServer ¶
NewLimitServer creates a new Server that limits the number of concurrent executions.
It uses a buffered channel to limit the number of concurrent executions.
Directories ¶
Path | Synopsis |
---|---|
Package cache provides a base for an Image cache.
|
Package cache provides a base for an Image cache. |
_test
Package _test provides utilities for imageserver/cache.Cache testing.
|
Package _test provides utilities for imageserver/cache.Cache testing. |
file
Package file provides a disk based cache.
|
Package file provides a disk based cache. |
groupcache
Package groupcache provides a groupcache imageserver.Server implementation.
|
Package groupcache provides a groupcache imageserver.Server implementation. |
memcache
Package memcache provides a Memcache imageserver/cache.Cache implementation.
|
Package memcache provides a Memcache imageserver/cache.Cache implementation. |
memory
Package memory provides an in-memory imageserver/cache.Cache implementation.
|
Package memory provides an in-memory imageserver/cache.Cache implementation. |
redis
Package redis provides a Redis imageserver/cache.Cache implementation.
|
Package redis provides a Redis imageserver/cache.Cache implementation. |
examples
|
|
advanced
Package advanced provides an advanced example.
|
Package advanced provides an advanced example. |
cache
Package cache provides a cache example.
|
Package cache provides a cache example. |
groupcache
Package advanced provides a groupcache example.
|
Package advanced provides a groupcache example. |
httpsource
Package httpsource provides a HTTP Source example.
|
Package httpsource provides a HTTP Source example. |
simple
Package simple provides a simple example.
|
Package simple provides a simple example. |
Package graphicsmagick provides a GraphicsMagick imageserver.Handler implementation.
|
Package graphicsmagick provides a GraphicsMagick imageserver.Handler implementation. |
Package http provides a net/http.Handler implementation that wraps a imageserver.Server.
|
Package http provides a net/http.Handler implementation that wraps a imageserver.Server. |
crop
Package crop provides a imageserver/http.Parser implementation for imageserver/image/crop.Processor.
|
Package crop provides a imageserver/http.Parser implementation for imageserver/image/crop.Processor. |
gamma
Package gamma provides a imageserver/http.Parser implementation for imageserver/image/gamma.CorrectionProcessor.
|
Package gamma provides a imageserver/http.Parser implementation for imageserver/image/gamma.CorrectionProcessor. |
gift
Package gift provides imageserver/http.Parser implementations for imageserver/image/gift.
|
Package gift provides imageserver/http.Parser implementations for imageserver/image/gift. |
graphicsmagick
Package graphicsmagick provides a imageserver/http.Parser implementation for imageserver/graphicsmagick.Handler.
|
Package graphicsmagick provides a imageserver/http.Parser implementation for imageserver/graphicsmagick.Handler. |
image
Package image provides imageserver/http.Parser implementations for imageserver/image.
|
Package image provides imageserver/http.Parser implementations for imageserver/image. |
nfntresize
Package nfntresize provides a imageserver/http.Parser implementation for imageserver/image/nfntresize.Processor.
|
Package nfntresize provides a imageserver/http.Parser implementation for imageserver/image/nfntresize.Processor. |
Package image provides a bridge to the Go "image" package.
|
Package image provides a bridge to the Go "image" package. |
_test
Package _test provides utilities for imageserver/image.Encoder testing.
|
Package _test provides utilities for imageserver/image.Encoder testing. |
bmp
Package bmp provides a BMP imageserver/image.Encoder implementation.
|
Package bmp provides a BMP imageserver/image.Encoder implementation. |
crop
Package crop provides a imageserver/image.Processor implementation that allows to crop Image.
|
Package crop provides a imageserver/image.Processor implementation that allows to crop Image. |
gamma
Package gamma provides gamma imageserver/image.Processor implementations.
|
Package gamma provides gamma imageserver/image.Processor implementations. |
gif
Package gif provides GIF imageserver/image.Encoder|Processor and imageserver.Handler implementations.
|
Package gif provides GIF imageserver/image.Encoder|Processor and imageserver.Handler implementations. |
gift
Package gift provides imageserver/image.Processor implementations for GIFT.
|
Package gift provides imageserver/image.Processor implementations for GIFT. |
internal
Package internal provides utilities functions used in the image package.
|
Package internal provides utilities functions used in the image package. |
jpeg
Package jpeg provides a JPEG imageserver/image.Encoder implementation.
|
Package jpeg provides a JPEG imageserver/image.Encoder implementation. |
nfntresize
Package nfntresize provides a nfnt/resize imageserver/image.Processor implementation.
|
Package nfntresize provides a nfnt/resize imageserver/image.Processor implementation. |
png
Package png provides a PNG imageserver/image.Encoder implementation.
|
Package png provides a PNG imageserver/image.Encoder implementation. |
tiff
Package tiff provides a TIFF imageserver/image.Encoder implementation.
|
Package tiff provides a TIFF imageserver/image.Encoder implementation. |
Package source provides a imageserver.Server implementation that forwards calls to the underlying Server with only the "source" param.
|
Package source provides a imageserver.Server implementation that forwards calls to the underlying Server with only the "source" param. |
file
Package file provides a imageserver.Server implementation that get the Image from a file.
|
Package file provides a imageserver.Server implementation that get the Image from a file. |
http
Package http provides a imageserver.Server implementation that gets the Image from an HTTP URL.
|
Package http provides a imageserver.Server implementation that gets the Image from an HTTP URL. |