gohouse / imgbed4github

image bed for github written in golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

images

the images bed repo

图床使用而已

package main

import (
	"encoding/json"
	"fmt"
	"github.com/gohouse/imgbed4github"
	"io/ioutil"
	"log"
)

var token = "token string"

func main() {
	gh := imgbed4github.NewGithub(token, "imgbed", "images")
	res,err := gh.UploadFromLocalFile("/path/to/img.jpg","img")
	if err!=nil {
		log.Println(err.Error())
		return
	}
	var resp imgbed4github.RepositoryContentResponse
	res.Bind(&resp)

	fmt.Println(*resp.Content.Name, *resp.Content.HTMLURL)
}

About

image bed for github written in golang


Languages

Language:Go 100.0%