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 ( // 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 ( // ProvidersImages represents what this library offers to external users in the form of dependencies. ProvidersImages = 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 ProcessFile.
Types ¶
type MediaUploadProcessor ¶
type MediaUploadProcessor interface { ProcessFile(ctx context.Context, req *http.Request, filename string) (*Upload, error) ProcessFiles(ctx context.Context, req *http.Request, filenamePrefix string) ([]*Upload, error) }
MediaUploadProcessor processes media uploads.
func NewImageUploadProcessor ¶
func NewImageUploadProcessor(logger logging.Logger, tracerProvider tracing.TracerProvider) MediaUploadProcessor
NewImageUploadProcessor provides a new MediaUploadProcessor.
type MockImageUploadProcessor ¶
MockImageUploadProcessor is a mock MediaUploadProcessor.
func (*MockImageUploadProcessor) ProcessFile ¶
func (m *MockImageUploadProcessor) ProcessFile(ctx context.Context, req *http.Request, filename string) (*Upload, error)
ProcessFile satisfies the MediaUploadProcessor interface.
func (*MockImageUploadProcessor) ProcessFiles ¶
Click to show internal directories.
Click to hide internal directories.