imgbb

package
v0.0.0-...-e3d9ab2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteAll

func DeleteAll(urls []string)

Types

type ImgbbImage

type ImgbbImage struct {
	Filename  string `json:"filename"`
	Name      string `json:"name"`
	Mime      string `json:"mime"`
	Extension string `json:"extension"`
	Url       string `json:"url"`
}

type ImgbbResponse

type ImgbbResponse struct {
	Data    ImgbbResponseData `json:"data"`
	Success bool              `json:"success"`
	Status  int               `json:"status"`
}

func Upload

func Upload(key string, image string, expiration int, name string) (*ImgbbResponse, error)

Uploads image to imgbb.com

@param key (required): The imgBB API key.

@param image (required): A binary file, base64 data, or a URL for an image. (up to 32 MB)

@param name (optional): The name of the file, this is automatically detected if uploading a file with a POST and multipart / form-data

@param expiration (optional): Enable this if you want to force uploads to be auto deleted after certain time (in seconds 60-15552000)

type ImgbbResponseData

type ImgbbResponseData struct {
	ID string `json:"id"`

	DisplayURL string `json:"display_url"`
	DeleteURL  string `json:"delete_url"`

	Expiration int `json:"expiration"`

	Height int `json:"height"`
	Width  int `json:"width"`

	Image  ImgbbImage  `json:"image"`
	Medium *ImgbbImage `json:"medium,omitempty"`
	Thumb  ImgbbImage  `json:"thumb"`
}

Jump to

Keyboard shortcuts

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