Skip to content

didil/gcf-go-image-resizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Image Resizer Cloud Function

Pure Go Image Resizer function, deployable to Google Cloud Functions, using the disintegration/imaging package

Medium article: Image Resizing with Go and Cloud Functions

Original gopher image:
Big Gopher

Resized gopher image:
Small Gopher

Example gopher image generated using gopherize.me

Usage

https://{gcf-endpoint}/ResizeImage?url={url}&height={height}&width={width}

  • url: url of the image to resize
  • height: height of the output image in pixels
  • width: width of the output image in pixels

if width or height is missing, the aspect ratio is preserved

Deploying

$ gcloud functions deploy ResizeImage --runtime go111 --trigger-http

Local testing

There is an http server included in cmd/server.go allowing you to test locally

$ export GO111MODULE=on
$ go get -u
$ go run cmd/server/server.go

Todo

  • Add tests
  • Cache input images
  • Cache output images

About

Go Image Resizer Cloud Function

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages