encoder

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2018 License: MIT Imports: 5 Imported by: 0

README

encoder

import "github.com/wyattjoh/ims/internal/image/encoder"

Overview

Index

Package files

encoder.go

type Encoder

type Encoder interface {
    Encode(m image.Image, w http.ResponseWriter) error
}

Encoder describes any type that can encode with the image and response writer.

func Get
func Get(format string, r *http.Request) Encoder

Get parses the format query variable and uses it to see if the user has specified the output format, otherwise, it tries to see if it can encode the image with the source format, otherwise, it just encodes it as "jpeg".

type WrapEncoderFunc

type WrapEncoderFunc func(m image.Image, w http.ResponseWriter) error

WrapEncoderFunc type is an adapter to allow the use of ordinary functions as image Encoders. If f is a function with the appropriate signature, WrapEncoderFunc(f) is a Encoder that calls f.

func (WrapEncoderFunc) Encode
func (f WrapEncoderFunc) Encode(m image.Image, w http.ResponseWriter) error

Encode calls f(m, w).


Generated by godoc2md

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder interface {
	Encode(m image.Image, w http.ResponseWriter) error
}

Encoder describes any type that can encode with the image and response writer.

func Get

func Get(format string, r *http.Request) Encoder

Get parses the `format` query variable and uses it to see if the user has specified the output format, otherwise, it tries to see if it can encode the image with the source format, otherwise, it just encodes it as "jpeg".

type WrapEncoderFunc

type WrapEncoderFunc func(m image.Image, w http.ResponseWriter) error

WrapEncoderFunc type is an adapter to allow the use of ordinary functions as image Encoders. If f is a function with the appropriate signature, WrapEncoderFunc(f) is a Encoder that calls f.

func (WrapEncoderFunc) Encode

Encode calls f(m, w).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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