imageserver

package module
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: May 12, 2019 License: MIT Imports: 8 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

imageserver

Godoc Report Tests Coverage Patreon

An HTTP service that converts image formats.

Style

Please take a look at the style guidelines if you'd like to make a pull request.

Sponsors

Scott Rayapoullé Eduard Urbach
Scott Rayapoullé Eduard Urbach

Want to see your own name here?

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerPort = "7000"

ServerPort is the default port

Functions

This section is empty.

Types

type JPEGFile

type JPEGFile struct {
	Directory string
	Width     int
	Height    int
	Quality   int
}

JPEGFile ...

func (*JPEGFile) Delete

func (output *JPEGFile) Delete(baseName string) error

Delete deletes the file from the file system.

func (*JPEGFile) Save

func (output *JPEGFile) Save(metaImage *MetaImage, baseName string) error

Save writes the image in JPEG format to the file system.

type MetaImage

type MetaImage struct {
	Image  image.Image
	Data   []byte
	Format string
}

MetaImage represents a single image with the name of the format and the original byte buffer that was used to create it.

func (*MetaImage) ConvertToFile

func (meta *MetaImage) ConvertToFile(format string, width int, height int, quality int, fileName string) error

ConvertToFile sends a request to the server and saves the resulting image in the given format. Format can be one of the following: png, jpeg, gif, webp

func (*MetaImage) Extension

func (meta *MetaImage) Extension() string

Extension returns the file extension of the image.

func (*MetaImage) String

func (meta *MetaImage) String() string

String returns a text representation of the format, width and height.

type OriginalFile

type OriginalFile struct {
	Directory string
	Width     int
	Height    int
	Quality   int
}

OriginalFile ...

func (*OriginalFile) Delete

func (output *OriginalFile) Delete(baseName string) error

Delete deletes the file from the file system.

func (*OriginalFile) Save

func (output *OriginalFile) Save(metaImage *MetaImage, baseName string) error

Save writes the original meta to the file system.

type Output

type Output interface {
	Save(img *MetaImage, baseName string) error
	Delete(baseName string) error
}

Output represents a system that saves an image locally (in database or as a file, e.g.)

type WebPFile

type WebPFile struct {
	Directory string
	Width     int
	Height    int
	Quality   int
}

WebPFile ...

func (*WebPFile) Delete

func (output *WebPFile) Delete(baseName string) error

Delete deletes the file from the file system.

func (*WebPFile) Save

func (output *WebPFile) Save(metaImage *MetaImage, baseName string) error

Save writes the image in WebP format to the file system.

Directories

Path Synopsis
cmd
imageserver module

Jump to

Keyboard shortcuts

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