imgbb

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2021 License: GPL-3.0 Imports: 10 Imported by: 2

README

imgbb

imgbb is a toolkit to help upload images to ImgBB.

Installation

Via Golang package get command

go get -u github.com/wabarc/imgbb/cmd/imgbb

From gobinaries.com:

$ curl -sf https://gobinaries.com/wabarc/imgbb | sh

Usage

Command-line:

$ imgbb
A CLI tool help upload images to ImgBB.

Usage:

  imgbb [options] [file1] ... [fileN]

  -k string
    	ImgBB api key, optional.

Go package:

import (
        "fmt"

        "github.com/wabarc/imgbb"
)

func main() {
        if url, err := i.Upload(path); err != nil {
            fmt.Fprintf(os.Stderr, "imgbb: %v\n", err)
        } else {
            fmt.Fprintf(os.Stdout, "%s  %s\n", url, path)
        }
}

License

This software is released under the terms of the GNU General Public License v3.0. See the LICENSE file for details.

Documentation

Index

Constants

View Source
const (
	IMGBB_URI = "https://imgbb.com/json"
	IMGBB_API = "https://api.imgbb.com/1/upload"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ImgBB

type ImgBB struct {
	Key string

	Client *http.Client
}

func NewImgBB

func NewImgBB(client *http.Client, key string) *ImgBB

func (*ImgBB) Parse

func (i *ImgBB) Parse(resp *http.Response) (string, error)

func (*ImgBB) Upload

func (i *ImgBB) Upload(path string) (string, error)

Directories

Path Synopsis
cmd
imgbb command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL