util

package
v0.0.0-...-8cdc3bd Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MimeTypeJpeg   = "image/jpeg"
	MimeTypePng    = "image/png"
	MimeTypeGif    = "image/gif"
	MimeTypeBitmap = "image/bmp"
	MimeTypeTiff   = "image/tiff"
	MimeTypeHEIF   = "image/heif"

	MimeTypeQuickTime = "video/quicktime"
	MimeTypeMp4       = "video/mp4"
)

These constants define the common MIME types of data MIME type is a label used to identify a type of data and allows tidepod to transcode different types of media

Variables

This section is empty.

Functions

func ConvertImageToJPG

func ConvertImageToJPG(originalFilename string, jpgFilename string)

ConvertImageToJPG converts a tif image to a jpg image

func ConvertPNGToJPG

func ConvertPNGToJPG(pngFilename string, jpgFilename string)

ConvertPNGToJPG converts a tif image to a jpg image

func GetMediaType

func GetMediaType(filename string) string

GetMediaType returns "photo" or "video" depending on the type of file

func GetPhotoRotation

func GetPhotoRotation(fullFilePath string) float64

GetPhotoRotation reads the EXIF data and returns the rotation angle of the photo

func IsValidMediaType

func IsValidMediaType(filename string) bool

IsValidMediaType returns true if the file is either a photo or video

func NormalizedExt

func NormalizedExt(fileName string) string

NormalizedExt returns the file extension without dot and in lowercase.

func UpdateMobilePhotoWithEXIF

func UpdateMobilePhotoWithEXIF(photo *entity.Photo, info map[string]interface{})

UpdateMobilePhotoWithEXIF extracts EXIF information from the info JSON object. Updates database entry appropriately with this information

func UpdatePhotoRotation

func UpdatePhotoRotation(fullFilePath string)

UpdatePhotoRotation checks the photo for rotation inconsistencies and rotates the image appropriately

func UpdatePhotoWithEXIF

func UpdatePhotoWithEXIF(photo *entity.Photo, file *os.File)

UpdatePhotoWithEXIF extracts EXIF information from image. Updates database entry appropriately with this information

Types

This section is empty.

Jump to

Keyboard shortcuts

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