file-processor

command module
v0.0.0-...-1b90486 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 0 Imported by: 0

README

File Processor

A GO library for manipulating and processing images

GoDoc GoDoc Gitter FOSSA Status

Prerequisites

This package needs at least Go 1.15.6

Installation

 go get -u github.com/rayne22/file-processor

Easy right...

Usage

Import package using

import "github.com/rayne22/file-processor/process"

Image Resizing
  • process.ResizeImage produces a scaled image based on the width and height provided using the interpolation. If there is need to preserve the aspect ratio, the width or height can be set to 0.
Struct
type UploadedImage struct {
	Path        string `json:"path"`
	ImageName   string `json:"image_name"`
	Width       uint   `json:"width"`
	Height      uint   `json:"height"`
	Request     multipart.File
	ImageHeader *multipart.FileHeader
}
Function
func (u *UploadedImage) ResizeImage() string 
Example

processor := process.UploadedImage{}  //Initializing the Struct


processor.Height = 200  // Adding height
processor.Width = 200  // Adding width
processor.Path = "temp"  // Adding temporary image storage directory

processor.Request = file //  If image is being posted through a form, the file is stored in this field
processor.ImageHeader = fileHeader // If image is being posted through a form, the fileHeader is stored in this field

_= processor.ResizeImage() // Function for resizing images

NB: The above code should be inside a function

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

FOSSA Status

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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