assets

package
v0.0.0-...-ff8e54b Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: AGPL-3.0, AGPL-3.0-or-later Imports: 5 Imported by: 0

Documentation

Overview

Package assets manages imager file asset allocation and deallocation

Index

Constants

This section is empty.

Variables

View Source
var (
	//  StdJPEG is a JPEG sample image standard struct. Only used in tests.
	StdJPEG = common.Image{
		ImageCommon: common.ImageCommon{
			SHA1:     "012a2f912c9ee93ceb0ccb8684a29ec571990a94",
			FileType: common.JPEG,
			Dims:     StdDims["jpeg"],
			MD5:      "YOQQklgfezKbBXuEAsqopw",
			Size:     300792,
		},
	}

	// StdDims contains esulting dimentions after thumbnailing sample images.
	// Only used in tests.
	StdDims = map[string][4]uint16{
		"jpeg": {0x43c, 0x371, 0x96, 0x79},
		"png":  {0x500, 0x2d0, 0x96, 0x54},
		"gif":  {0x248, 0x2d0, 0x79, 0x96},
		"pdf":  {0x253, 0x34a, 0x69, 0x96},
	}
)

Only used in tests, but we still need them exported

Functions

func BlurPath

func BlurPath(thumbType uint8, SHA1 string) string

BlurPath returns the path to the blured thumbnail of an image

func BlurPathLocal

func BlurPathLocal(thumbType uint8, SHA1 string) string

func CreateDirs

func CreateDirs() error

CreateDirs creates directories for processed image storage

func Delete

func Delete(SHA1 string, fileType, thumbType uint8) error

Delete deletes file assets belonging to a single upload

func DeleteSmile

func DeleteSmile(SHA1 string, fileType uint8) error

Delete deletes file assets belonging to a single upload

func SmilePath

func SmilePath(fileType uint8, SHA1 string) string

SorucePath returns the path to the source file of a smile

func SourcePath

func SourcePath(fileType uint8, SHA1 string) string

SourcePath returns the path to the source file on an image

func ThumbPath

func ThumbPath(thumbType uint8, SHA1 string) string

ThumbPath returns the path to the thumbnail of an image

func ThumbPathLocal

func ThumbPathLocal(thumbType uint8, SHA1 string) string

func Write

func Write(SHA1 string, fileType, thumbType uint8, src, thumb []byte) error

Write writes file assets to disk

func WriteSmile

func WriteSmile(SHA1 string, fileType uint8, src []byte) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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