images

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Images.
	PNG  = "png"
	JPEG = "jpeg"
	JPG  = "jpg"
	GIF  = "gif"
	WEBP = "webp"
	TIFF = "tiff"
	BMP  = "bmp"

	// Documents.
	PDF = "pdf"
)

Variables

This section is empty.

Functions

func ParseMimeType

func ParseMimeType(mimetype string) string

Types

type Bmp

type Bmp struct {
	// contains filtered or unexported fields
}

Bmp struct implements the File and Image interface from the files pkg.

func NewBmp

func NewBmp() *Bmp

NewBmp returns a pointer to a Bmp instance. The Bmp object is set with a map with list of supported file formats.

func (*Bmp) ConvertTo

func (b *Bmp) ConvertTo(fileType, subType string, file io.Reader) (io.Reader, error)

ConvertTo method converts a given file to a target format. This method returns a file in form of a slice of bytes. The methd receives a file type and the sub-type of the target format and the file as array of bytes.

func (*Bmp) ImageType

func (b *Bmp) ImageType() string

ImageType returns the file format of the current image. This method implements the Image interface.

func (*Bmp) SupportedFormats

func (b *Bmp) SupportedFormats() map[string][]string

SupportedFormats returns a map with a slice of supported files. Every key of the map represents a kind of a file.

func (*Bmp) SupportedMIMETypes added in v0.2.0

func (b *Bmp) SupportedMIMETypes() map[string][]string

SupportedMIMETypes returns a map with a slice of supported MIME types.

type Gif

type Gif struct {
	// contains filtered or unexported fields
}

Gif struct implements the File and Image interface from the files pkg.

func NewGif

func NewGif() *Gif

NewGif returns a pointer to a Gif instance. The Gif object is set with a map with list of supported file formats.

func (*Gif) ConvertTo

func (g *Gif) ConvertTo(fileType, subType string, file io.Reader) (io.Reader, error)

ConvertTo method converts a given file to a target format. This method returns a file in form of a slice of bytes. The methd receives a file type and the sub-type of the target format and the file as array of bytes.

func (*Gif) ImageType

func (g *Gif) ImageType() string

ImageType returns the file format of the current image. This method implements the Image interface.

func (*Gif) SupportedFormats

func (g *Gif) SupportedFormats() map[string][]string

SupportedFormats returns a map with a slice of supported files. Every key of the map represents the kind of a file.

func (*Gif) SupportedMIMETypes added in v0.2.0

func (g *Gif) SupportedMIMETypes() map[string][]string

SupportedMIMETypes returns a map with a slice of supported MIME types.

type Jpeg

type Jpeg struct {
	// contains filtered or unexported fields
}

Jpeg struct implements the File and Image interface from the files pkg.

func NewJpeg

func NewJpeg() *Jpeg

NewJpeg returns a pointer to a Jpeg instance. The Jpeg object is set with a map with list of supported file formats.

func (*Jpeg) ConvertTo

func (j *Jpeg) ConvertTo(fileType, subType string, file io.Reader) (io.Reader, error)

ConvertTo method converts a given file to a target format. This method returns a file in form of a slice of bytes. The methd receives a file type and the sub-type of the target format and the file as array of bytes.

func (*Jpeg) ImageType

func (j *Jpeg) ImageType() string

ImageType returns the file format of the current image. This method implements the Image interface.

func (*Jpeg) SupportedFormats

func (j *Jpeg) SupportedFormats() map[string][]string

SupportedFormats returns a map with a slice of supported files. Every key of the map represents a kind of a file.

func (*Jpeg) SupportedMIMETypes added in v0.2.0

func (j *Jpeg) SupportedMIMETypes() map[string][]string

SupportedMIMETypes returns a map with a slice of supported MIME types.

type Png

type Png struct {
	// contains filtered or unexported fields
}

Png struct implements the File and Image interface from the files pkg.

func NewPng

func NewPng() *Png

NewPng returns a pointer to a Png instance. The Png object is set with a map with list of supported file formats.

func (*Png) ConvertTo

func (p *Png) ConvertTo(fileType, subType string, file io.Reader) (io.Reader, error)

ConvertTo method converts a given file to a target format. This method returns a file in form of a slice of bytes.

func (*Png) ImageType

func (p *Png) ImageType() string

ImageType returns the file format of the current image. This method implements the Image interface.

func (*Png) SupportedFormats

func (p *Png) SupportedFormats() map[string][]string

SupportedFormats returns a map with a slice of supported files. Every key of the map represents the kind of a file.

func (*Png) SupportedMIMETypes added in v0.2.0

func (p *Png) SupportedMIMETypes() map[string][]string

SupportedMIMETypes returns a map with a slice of supported MIME types.

type Tiff

type Tiff struct {
	// contains filtered or unexported fields
}

Tiff struct implements the File and Image interface from the files pkg.

func NewTiff

func NewTiff() *Tiff

NewTiff returns a pointer to a Tiff instance. The Tiff object is set with a map with list of supported file formats.

func (*Tiff) ConvertTo

func (t *Tiff) ConvertTo(fileType, subType string, file io.Reader) (io.Reader, error)

ConvertTo method converts a given file to a target format. This method returns a file in form of a slice of bytes.

func (*Tiff) ImageType

func (t *Tiff) ImageType() string

ImageType returns the file format of the current image. This method implements the Image interface.

func (*Tiff) SupportedFormats

func (t *Tiff) SupportedFormats() map[string][]string

SupportedFormats method returns a map with a slice of supported files. Every key of the map represents the kind of a file.

func (*Tiff) SupportedMIMETypes added in v0.2.0

func (t *Tiff) SupportedMIMETypes() map[string][]string

SupportedMIMETypes returns a map with a slice of supported MIME types.

type Webp

type Webp struct {
	// contains filtered or unexported fields
}

Webp struct implements the File and Image interface from the files pkg.

func NewWebp

func NewWebp() *Webp

NewWebp returns a pointer to a Webp instance. The Webp object is set with a map with list of supported file formats.

func (*Webp) ConvertTo

func (w *Webp) ConvertTo(fileType, subType string, file io.Reader) (io.Reader, error)

ConvertTo method converts a given file to a target format. This method returns a file in form of a slice of bytes.

func (*Webp) ImageType

func (w *Webp) ImageType() string

ImageType method returns the file format of the current image. This method implements the Image interface.

func (*Webp) SupportedFormats

func (w *Webp) SupportedFormats() map[string][]string

SupportedFormats returns a map with a slice of supported files. Every key of the map represents the kind of a file.

func (*Webp) SupportedMIMETypes added in v0.2.0

func (w *Webp) SupportedMIMETypes() map[string][]string

SupportedMIMETypes returns a map with a slice of supported MIME types.

Jump to

Keyboard shortcuts

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