From 42adbab0fa85b8b84af61ab08189858f22a6de7f Mon Sep 17 00:00:00 2001 From: Jens Breitbart Date: Fri, 1 Apr 2016 16:20:04 +0200 Subject: [PATCH] Small cleanup --- uploadImage.go | 58 +++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/uploadImage.go b/uploadImage.go index b15d275..d58b863 100644 --- a/uploadImage.go +++ b/uploadImage.go @@ -10,35 +10,6 @@ import ( "strconv" ) -func createUploadForm(image []byte, album string, dtype string, title string, description string) url.Values { - form := url.Values{} - - if dtype == "binary" { - form.Add("image", string(image[:])) - form.Add("type", "file") - } - if dtype == "base64" { - form.Add("image", string(image[:])) - form.Add("type", "base64") - } - if dtype == "URL" { - form.Add("image", string(image[:])) - form.Add("type", "URL") - } - - if album != "" { - form.Add("album", album) - } - if title != "" { - form.Add("title", title) - } - if description != "" { - form.Add("description", description) - } - - return form -} - // UploadImage uploads the image to imgur // image Can be a binary file, base64 data, or a URL for an image. (up to 10MB) // album optional The id of the album you want to add the image to. @@ -97,3 +68,32 @@ func (client *Client) UploadImage(image []byte, album string, dtype string, titl return img.Ii, img.Status, nil } + +func createUploadForm(image []byte, album string, dtype string, title string, description string) url.Values { + form := url.Values{} + + if dtype == "binary" { + form.Add("image", string(image[:])) + form.Add("type", "file") + } + if dtype == "base64" { + form.Add("image", string(image[:])) + form.Add("type", "base64") + } + if dtype == "URL" { + form.Add("image", string(image[:])) + form.Add("type", "URL") + } + + if album != "" { + form.Add("album", album) + } + if title != "" { + form.Add("title", title) + } + if description != "" { + form.Add("description", description) + } + + return form +}