api

package
v0.0.0-...-cc6b2b6 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	Handler *MemeHandler
	Router  *mux.Router
}

func (*Controller) Load

func (r *Controller) Load(tplPath string)

Load sets up all dynamic routes.

func (*Controller) StaticRoute

func (r *Controller) StaticRoute(uriPrefix string, docRoot string)

StaticRoute sets up a static route

type MemeHandler

type MemeHandler struct {
	// ImgPath is the filesystem path where all images are located
	ImgPath string
	// OutputPath is the path on the filesystem where all memes will be saved
	OutputPath string
	// FontName is the font to use
	FontName string
	// MemeURL is the url at which the file will be served
	MemeURL string
	// contains filtered or unexported fields
}

MemeHandler is the base structure that handles most web operations

func (*MemeHandler) Form

func (h *MemeHandler) Form(w http.ResponseWriter, r *http.Request)

Form returns a form that will generate the meme

func (*MemeHandler) ListGifs

func (h *MemeHandler) ListGifs(w http.ResponseWriter, r *http.Request)

ListGifs lists the available GIFs

func (*MemeHandler) LoadTemplates

func (h *MemeHandler) LoadTemplates(basepath string)

LoadTemplates pre-parses the templates. Must be called before starting the server.

func (*MemeHandler) MemeFromRequest

func (h *MemeHandler) MemeFromRequest(w http.ResponseWriter, r *http.Request)

MemeFromRequest generates a meme image from a request, and saves it to disk. Then sends a 301 to the user.

func (*MemeHandler) Preview

func (h *MemeHandler) Preview(w http.ResponseWriter, r *http.Request)

Preview returns a thumbnail, in jpeg format

func (*MemeHandler) UID

func (h *MemeHandler) UID(r *http.Request) (string, error)

UID returns the unique ID of the requested gif. This is determined by a combination of the image name and the text (top and bottom)

Jump to

Keyboard shortcuts

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