gomeme-api

command module
v0.0.0-...-23ff3f9 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 8 Imported by: 0

README

GoMeme-API

Service puts your text on an image. Create image macro style memes.
Based on nomad-software/meme.

pipeline status Go Report Card Hits-of-Code

Usage example

Install

  • Install Go
  • Run go get -u -v gitlab.com/nikkofox/gomeme-api

Docker

Docker image is available in the project Container Registry

docker login registry.gitlab.com
docker run -p "7744:7744" -d registry.gitlab.com/nikkofox/gomeme-api/develop

Indices


POST image by FORM

Endpoint:

Method: POST
Type: FORMDATA
URL: /meme/create

Body:

Key Type Description
image file form-data (Required)
top_text string (Optional)
bottom_text string (Optional)
fast_stroke string (Optional, default: false) Convert to bool. Inaccurate but fast stroke
POST image by JSON

Endpoint:

Method: POST
Type: JSON
URL: /meme/create

Body:

Key Type Description
image string (Required) URL | image path on server | Data URI Base64 Encoded Image
top_text string (Optional)
bottom_text string (Optional)
fast_stroke bool (Optional, default: false) Inaccurate but fast stroke
{
    "image": "https://via.placeholder.com/600", 
    "top_text": "sample top text",
    "bottom_text": "sample bottom text"
}
Response
Key Value Description
Content-Type image/jpeg Binary data stream for the responsive image.

Build with custom fonts

It is possible to add any font you want by copying the font into the fonts folder and passing FONT environment variable. In order to add your custom fonts follow the steps:

cp <your_font_path> data/fonts
docker build -t gomeme:latest .
docker run -p "7744:7744" -e FONT="<your_font_name>" gomeme:latest

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package controllers contains route handlers
Package controllers contains route handlers
nolint Package data contains data assets to be compiled
nolint Package data contains data assets to be compiled
Package font processes the font file
Package font processes the font file
Package image func for rendering and loading images
Package image func for rendering and loading images
draw
Package draw contains functionality for drawing text
Package draw contains functionality for drawing text
stream
Package stream work with io.Reader
Package stream work with io.Reader
Package models contains structures
Package models contains structures
Package services ??? just because
Package services ??? just because

Jump to

Keyboard shortcuts

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