thumbnail

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: BSD-3-Clause Imports: 9 Imported by: 1

README

Thumbnail Generation Package for Go

This package provides method to create thumbnails from provided images.

Installation

Use to go command:

$ go get git.sr.ht/~mjorgensen/go-thumbnail

Example

package main

import (
	"fmt"
	"io/ioutil"

	"git.sr.ht/~mjorgensen/go-thumbnail"
)

func main() {
	thumbCfg := thumbnail.Configuration{
		Path: "./image.jpeg",
		ContentType: "image/jpeg",
		DestinationPrefix: "thumb_",
	}
	testImage, err := ioutil.ReadFile(thumbCfg.Path)
	if err != nil {
		panic(err)
	}

	err = Create(testImage, thumbCfg)
	if err != nil {
		panic(err)
	}
}

Resources

Comprehensive documentation still needs to be written but will eventually be found here.

Discussion and patches are welcome and should be directed to my public inbox for now: ~mjorgensen/public-inbox@lists.sr.ht. Please use --subject-prefix PATCH go-thumbnail for clarity when sending patches.

Bugs, issues, planning, and tasks can all be found at the tracker: ~mjorgensen/go-thumbnail.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(fb []byte, cfg Configuration) error

Create generates ta thumbnail.

Types

type Configuration added in v0.1.1

type Configuration struct {
	Path              string
	ContentType       string
	DestinationPrefix string
}

A Configuration sets all the configurable options for thumbnail generation.

type Image

type Image struct {
	Filename    string
	ContentType string
	Data        []byte
	Size        int
}

An Image is an image and it's information.

Jump to

Keyboard shortcuts

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