go-imageupload

by olahol

:white_square_button: Gracefully handle image uploading and thumbnail creation.

124 Stars 16 Forks Last release: Not found 5 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

go-imageupload

GoDoc

:whitesquarebutton: Gracefully handle image uploading and thumbnail creation.

Install

go get github.com/olahol/go-imageupload

Example

Thumbnail creator using Gin.

package main

import ( "github.com/gin-gonic/gin" "github.com/olahol/go-imageupload" )

func main() { r := gin.Default()

r.GET("/", func(c *gin.Context) {
    c.File("index.html")
})

r.POST("/upload", func(c *gin.Context) {
    img, err := imageupload.Process(c.Request, "file")

    if err != nil {
        panic(err)
    }

    thumb, err := imageupload.ThumbnailPNG(img, 300, 300)

    if err != nil {
        panic(err)
    }

    thumb.Write(c.Writer)
})

r.Run(":5000")

}

  

Contributors

  • Ola Holmström (@olahol)
  • Shintaro Kaneko (@kaneshin)

Documentation

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.