Documentation ¶
Overview ¶
Package assets manages imager file asset allocation and deallocation
Index ¶
- Variables
- func CreateDirs() error
- func Delete(SHA1 string, fileType, thumbType uint8) error
- func DeleteDirs() error
- func GetFilePaths(SHA1 string, fileType, thumbType uint8) (paths [2]string)
- func ImageSearchPath(img common.ImageCommon) string
- func RelativeSourcePath(fileType uint8, SHA1 string) string
- func ResetDirs() error
- func SourcePath(fileType uint8, SHA1 string) string
- func ThumbPath(thumbType uint8, SHA1 string) string
- func Write(SHA1 string, fileType, thumbType uint8, src, thumb []byte) error
Constants ¶
This section is empty.
Variables ¶
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, }, Name: "sample.jpg", Spoiler: true, } // 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 CreateDirs ¶
func CreateDirs() error
CreateDirs creates directories for processed image storage
func DeleteDirs ¶
func DeleteDirs() error
DeleteDirs recursively deletes the image storage folder. Only used for cleaning up after tests.
func GetFilePaths ¶
GetFilePaths generates file paths of the source file and its thumbnail
func ImageSearchPath ¶
func ImageSearchPath(img common.ImageCommon) string
ImageSearchPath returns the relative path used for image search file lookups. If files is not JPEG, PNG or GIF, returns the thumbnail instead of the source file.
func RelativeSourcePath ¶
RelativeSourcePath returns an file's source path relative to the root path
func ResetDirs ¶
func ResetDirs() error
ResetDirs removes all contents from the image storage directories. Only used for cleaning up after tests.
func SourcePath ¶
SourcePath returns the path to the source file on an image
Types ¶
This section is empty.