Skip to content

mococa/go-imgbb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

go-imgbb

Golang package for ImgBB image hosting

Installation

go get github.com/mococa/go-imgbb

Example

package main

import (
  "fmt"
  "log"
  
  imgbb "github.com/mococa/go-imgbb"
)

func main() {
  imgbb_key := "2d6be3a136b331830b377bfe5951bc03"
  img_base64 := "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHCBESFRUUEhYSERgSFBIYFRUYFRUVGhEVGRoaGRkUGRYeIy4nHB8rIxYWJjgmKy8xNjU3HCU7QzszPy40NTEBDAwMEA8QHhISHj8sISs/NzQ1Njc2NDQxNDQ0MTQ0NDQ0Nj00PTE0NDQ0NDQ0MTQ0NDQ0NDQ0MTQxNDQxNDE0Mf/AABEIAOEA4QMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAABgcBBAUCA//EAEQQAAICAgADBAYECwcDBQAAAAECAAMEEQUSIRMxQVEGIjJhcZEUQlKBByMzYnJ0gpKhorEVNLKzwcLRFlODJENzw/D/xAAZAQEAAwEBAAAAAAAAAAAAAAAAAwQFAgH/xAAmEQEAAgECBQUAAwAAAAAAAAAAAQIDBBESEyExQSIyM1FhI3GR/9oADAMBAAIRAxEAPwC5oiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICJianEOIU46F7nStVGyzEAD5wNuJDb/Sy6z+60NynutuJqU/ooRzt96r39859lmbb+VynXzWhEqHw5m52+8EfdO4x2nwhtnx17yn5sUd5HzmtbxKhPasrX4sB/WQH+yKj+UNt2/8Au3XWfwZiP4TNfBcReq4+OD59kmz9+pJGCftDOsr4hO14rjHutrP7YmwmSjdzKfvlfNwjEbvx8c/GpP8AieBwXFHsUon6ANf8UIicE/byNbXzCyAwPdqepXNOJZX+RycqvR3ytYb0/ds5iB8CJv4/pFm067etMpPF6do6jzNLE7/ZYn3Ti2OYTV1FLeU4ic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HwB7xvjBPD/x2IG5FG76Ns5tUD1rUJO+18T9vXnoypl1NYnhiWjptHafXb/E4xqFrRUUaCjQE+01sTJS1FsQhldQykdxBGwZsyNdIiICIiAiIgIiICIiAiIgIiIGJGfTlT2CNytYiX0PaigktWrqzeqPa1revEDXjJNPLoCCCNg94gQfhXEF7Bsy+wIl5515m0lNXsog/PI6sO/mYjwE849GVxE73ZiY3cANpbePtM3eiHY0o03Tqfqzs1+huAtvbCpefmLDoOjHvYeRPie8yQqoUaAAA8JDXFETuktkmY2Qyz0DrrUfQ7LcUr4K20b4owKn46375o28O4pV3pRkjzHPU2v5gT8pYcxLEXtHaVe2Klu8K0fiGQh1ZiZK+9TU4/xg/wAJj+2F8acof+En+hMswrueezXyHynfOsinS41a/wBr79mjKb/xcv8AiYT1XlZdn5PDu9xd60H8pY/wlkdmPIfKetRzrEaXHCv6uC8Ut9o0Yqnv5VNjj3hn0P5J1uHehVCMr3s+U69Q1h5uU+ajuX9kCSuJxN7T3lLXHWvaEQ4/wV6W+l4ajnUAW1bAXIrH1W/OGyVPgfcTOHxD0jxy1F1Dl7a35HxQdW2I409bVk9Cp5G5j09U9dGWXNQcOpDc/IvN56kNscWndPW8xGzm+h2G9GJTXYArKvVR1CbJIVT5Deh7hO9ESRwREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQP//Z"
  
  image, err := imgbb.Upload(imgbb_key, img_base64)
  if err != nil {
    log.Fatal(err)
  }
  
  fmt.Println(image.Data.DisplayURL) // returns https://i.ibb.co/SBbNB7X/6a9eb1a6b2bd.jpg
}

About

Golang package for ImgBB image hosting

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages