ImageBoss for Go
Use our official Go client library to generate ImageBoss URLs in your Go apps. Build URLs with operations (resize, cover, CDN), path-segment options, and optional signed URLs.
Installation
go get github.com/imageboss/go
Basic example
Create a URL builder with your ImageBoss source (from your dashboard), then build URLs with operations and options:
package main
import (
"fmt"
"github.com/imageboss/go"
)
func main() {
b, err := imageboss.NewURLBuilder("mywebsite-images")
if err != nil {
panic(err)
}
// Fixed width (proportional height)
url := b.CreateURL("examples/02.jpg", imageboss.Width(700))
fmt.Println(url)
// https://img.imageboss.me/mywebsite-images/width/700/examples/02.jpg
// Cover (exact dimensions, smart crop by default)
url = b.CreateURL("examples/02.jpg", imageboss.Cover(300, 300))
// With options (e.g. blur, format:auto)
url = b.CreateURL("examples/02.jpg", imageboss.Width(700), imageboss.Blur(4), imageboss.FormatAuto())
}
Operations include imageboss.CDN(), imageboss.Width(w), imageboss.Height(h), and imageboss.Cover(w, h). Use imageboss.CoverMode(w, h, "center") for crop modes. The library also supports srcset generation and signed URLs.
Full documentation
Signed URLs, srcset helpers, builder options, and more are documented at go-imageboss on GitHub.
Questions?
If you have any questions please don't hesitate, send us a message on support[at]imageboss.me or in case of any bugs or problems with your integration you're more than welcome to open an issue.