imagedata

package
v3.24.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSourceImageTypeNotSupported = ierrors.New(422, "Source image type not supported", "Invalid source image")

Functions

func BorrowBuffer added in v3.9.0

func BorrowBuffer() (*bytes.Buffer, context.CancelFunc)

func BuildImageRequest added in v3.8.0

func BuildImageRequest(ctx context.Context, imageURL string, header http.Header, jar *cookiejar.Jar) (*http.Request, context.CancelFunc, error)

func Init

func Init() error

func RedirectAllRequestsTo

func RedirectAllRequestsTo(u string)

func SendRequest added in v3.8.0

func SendRequest(req *http.Request) (*http.Response, error)

func StopRedirectingRequests

func StopRedirectingRequests()

Types

type DownloadOptions added in v3.14.0

type DownloadOptions struct {
	Header    http.Header
	CookieJar *cookiejar.Jar
}

type ErrorNotModified

type ErrorNotModified struct {
	Message string
	Headers map[string]string
}

func (*ErrorNotModified) Error

func (e *ErrorNotModified) Error() string

type ImageData

type ImageData struct {
	Type    imagetype.Type
	Data    []byte
	Headers map[string]string
	// contains filtered or unexported fields
}
var (
	Watermark     *ImageData
	FallbackImage *ImageData
)

func Download

func Download(ctx context.Context, imageURL, desc string, opts DownloadOptions, secopts security.Options) (*ImageData, error)

func FromBase64

func FromBase64(encoded, desc string, secopts security.Options) (*ImageData, error)

func FromFile

func FromFile(path, desc string, secopts security.Options) (*ImageData, error)

func (*ImageData) Close

func (d *ImageData) Close()

func (*ImageData) SetCancel

func (d *ImageData) SetCancel(cancel context.CancelFunc)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL