MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / ImageData

Interface ImageData

imagedata/image_data.go:20–31  ·  view source on GitHub ↗

ImageData represents the data of an image that can be read from a source. Please note that this interface can be backed by any reader, including lazy AsyncBuffer. There is no other way to guarantee that the data is read without errors except reading it till EOF.

Source from the content-addressed store, hash-verified

18// Please note that this interface can be backed by any reader, including lazy AsyncBuffer.
19// There is no other way to guarantee that the data is read without errors except reading it till EOF.
20type ImageData interface {
21 io.Closer // Close closes the image data and releases any resources held by it
22 Reader() io.ReadSeeker // Reader returns a new ReadSeeker for the image data
23 Format() imagetype.Type // Format returns the image format from the metadata (shortcut)
24 Size() (int, error) // Size returns the size of the image data in bytes
25 Error() error // Error returns any error that occurred during reading data from source
26
27 // AddCancel attaches a cancel function to the image data.
28 // Please note that Cancel functions must be idempotent: for instance, an implementation
29 // could wrap cancel into sync.Once.
30 AddCancel(cancel context.CancelFunc)
31}
32
33// imageDataBytes represents image data stored in a byte slice in memory
34type imageDataBytes struct {

Callers 32

LoadMethod · 0.65
LoadThumbnailMethod · 0.65
TestAsyncBufferReaderFunction · 0.65
TestAsyncBufferCloseFunction · 0.65
calcHashMethod · 0.65
respondWithImageMethod · 0.65
ReaderMethod · 0.65
LoadMethod · 0.65
LoadThumbnailMethod · 0.65

Implementers 2

imageDataBytesimagedata/image_data.go
imageDataAsyncBufferimagedata/image_data.go

Calls

no outgoing calls

Tested by

no test coverage detected