Documentation ¶
Overview ¶
Package images is largely (and respectfully) inspired by/copied from this repo: github.com/olahol/go-imageupload
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidContentType is what we return to indicate the provided data was of the wrong type. ErrInvalidContentType = errors.New("invalid content type") // ErrInvalidImageContentType is what we return to indicate the provided image was of the wrong type. ErrInvalidImageContentType = errors.New("invalid image content type") )
View Source
var ( // Providers represents what this library offers to external users in the form of dependencies. Providers = wire.NewSet( NewImageUploadProcessor, ) )
Functions ¶
func LimitFileSize ¶
func LimitFileSize(maxSize uint16, res http.ResponseWriter, req *http.Request)
LimitFileSize limits the size of uploaded files, for use before Process.
Types ¶
type Image ¶
Image is a helper struct for handling images.
type ImageUploadProcessor ¶
type ImageUploadProcessor interface {
Process(ctx context.Context, req *http.Request, filename string) (*Image, error)
}
ImageUploadProcessor process image uploads.
func NewImageUploadProcessor ¶
func NewImageUploadProcessor(logger logging.Logger) ImageUploadProcessor
NewImageUploadProcessor provides a new ImageUploadProcessor.
type MockImageUploadProcessor ¶
MockImageUploadProcessor is a mock ImageUploadProcessor.
func (*MockImageUploadProcessor) BuildAvatarUploadMiddleware ¶
func (m *MockImageUploadProcessor) BuildAvatarUploadMiddleware(next http.Handler, encoderDecoder encoding.ServerEncoderDecoder, filename string) http.Handler
BuildAvatarUploadMiddleware satisfies the ImageUploadProcessor interface.
Click to show internal directories.
Click to hide internal directories.