Documentation ¶
Index ¶
- Constants
- Variables
- func ContentTypeToImagingFormat(contentType string) (imaging.Format, error)
- func NewErrInvalidArgument(message string, kv map[string]interface{}, err error) error
- type Error
- type FormatType
- type ImageMeta
- type ImageService
- func (s *ImageService) Read(ctx context.Context, bucket string, object string) (img image.Image, attrs *storage.ObjectAttrs, err error)
- func (s *ImageService) ResizeToFitLongSide(ctx context.Context, src image.Image, size int) (dst image.Image, err error)
- func (s *ImageService) Write(ctx context.Context, bucket string, object string, img image.Image, ...) (err error)
- type ResizeHandlers
- type ResizeRequest
Constants ¶
View Source
const MaxResizeSize = 2560
View Source
const MinResizeSize = 0
Variables ¶
View Source
var ErrInvalidArgument = &Error{ Code: "InvalidArgument", Message: "invalid argument", KV: map[string]interface{}{}, }
ErrInvalidArgument is 引数に問題がある時に返す
Functions ¶
Types ¶
type Error ¶
type Error struct { Code string Message string KV map[string]interface{} // contains filtered or unexported fields }
Error is Error情報を保持する struct
type FormatType ¶
type FormatType int
const ( Default FormatType = iota PNG JPEG )
func (FormatType) ImagingFormat ¶
func (ft FormatType) ImagingFormat() imaging.Format
type ImageMeta ¶
type ImageMeta struct { FormatType FormatType ContentType string }
type ImageService ¶
func NewImageService ¶
func (*ImageService) Read ¶
func (s *ImageService) Read(ctx context.Context, bucket string, object string) (img image.Image, attrs *storage.ObjectAttrs, err error)
type ResizeHandlers ¶
type ResizeHandlers struct {
// contains filtered or unexported fields
}
func NewResizeHandlers ¶
func NewResizeHandlers(ctx context.Context, basePath string, alterBucket string, imageService *ImageService) *ResizeHandlers
func (*ResizeHandlers) ResizeHandler ¶
func (h *ResizeHandlers) ResizeHandler(w http.ResponseWriter, r *http.Request)
ResizeHandler is Pathで指定したCloud Storage上のObjectを指定したサイズにResizeして返す このまま使うこともできるが、Exampleの意味合いが強い
type ResizeRequest ¶
func BuildResizeRequest ¶
func BuildResizeRequest(path string) (*ResizeRequest, error)
BuildResizeRequest is Request URLからResizeに必要な情報を生成する App Engine Image Serviceと同じ雰囲気のURLを利用する時に使う
期待する形式 `/{bucket}/{object}` `/{bucket}/{object}/=sXXX`
Click to show internal directories.
Click to hide internal directories.