MCPcopy Create free account
hub / github.com/LevInteractive/imageup / GetDimensions

Function GetDimensions

gcp.go:63–71  ·  view source on GitHub ↗

GetDimensions grabs the width and height of an image in the cloud.

(f io.Reader)

Source from the content-addressed store, hash-verified

61
62// GetDimensions grabs the width and height of an image in the cloud.
63func GetDimensions(f io.Reader) (int, int, error) {
64 img, _, err := image.Decode(f)
65 if err != nil {
66 return 0, 0, err
67 }
68
69 bounds := img.Bounds()
70 return bounds.Max.X, bounds.Max.Y, nil
71}
72
73// RemoveFileFromGCP removes a file from GCP.
74func RemoveFileFromGCP(name string) error {

Callers 1

TestGetDimensionsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestGetDimensionsFunction · 0.68