thumb

package
v0.1.43 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

README

Generate Thumbnails of Images

Two services are provided. One is to generate a thumbnail and return that thumbnail. The second generates the thumbnail and returns the URL/Path to the image.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DbOn map[string]bool

Functions

func ConvertUrlToPath

func ConvertUrlToPath(fnUrl string) (fn string)

func GenThumbnail

func GenThumbnail(fns []string, width, height, owidth, oheight int, to string) error

func GetImageDimension

func GetImageDimension(imagePath string) (width int, height int)

GetImageDimension returns width, height of an immage - .png, .jpg, .gif

  • not working on .svg
  • not returning errors

Example:

h, w = GetHWFromImage ( ffile_name );

func SetupMux

func SetupMux(mux *ymux.ServeMux)

func SetupThumbnail

func SetupThumbnail(cfg *ThumbnailType, xcfg *ymux.BaseConfigType, dbF map[string]bool, f *os.File)

func ThumbnailImage

func ThumbnailImage(www http.ResponseWriter, req *http.Request)

Returns a Thumbnail for an image

func ThumbnailURL

func ThumbnailURL(www http.ResponseWriter, req *http.Request)

Types

type ThumbnailType

type ThumbnailType struct {
	ThumbnailPath    string `json:"thumbnail_path" default:"./www/thumb"`
	ThumbnailPathURL string `json:"thumbnail_path_url" default:"/thumb"`
	ImagePath        string `json:"image_path" default:"./www/files"` // same as upload path?
	ImagePathURL     string `json:"image_url" default:"/files"`       // same as url_upload_path
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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