func FromLocal(fname string) (string, error) {
	var b bytes.Buffer
	fileExists, _ := exists(fname)
	if !fileExists {
		return "", fmt.Errorf("File does not exist\n")
	}
	file, err := os.Open(fname)
	if err != nil {
		return "", fmt.Errorf("Error opening file\n")
	}
	_, err = b.ReadFrom(file)
	if err != nil {
		return "", fmt.Errorf("Error reading file to buffer\n")
	}
	return FromBuffer(b), nil
}
FromLocal reads a local file and returns
the base64 encoded version.
package imgbase64
import (
	"bytes"
	"encoding/base64"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"strings"
)
var df string = ""
func DefaultImage() string {
	return df
}
func SetDefaultImage(img string) {
	df = img
}
func encode(bin []byte) []byte {
	e64 := base64.StdEncoding
	maxEncLen := e64.EncodedLen(len(bin))
	encBuf := make([]byte, maxEncLen)
	e64.Encode(encBuf, bin)
	return encBuf
}
func get(url string) ([]byte, string) {
	resp, err := http.Get(url)
	if err != nil {
		log.Fatal("Error getting url.")
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	ct := resp.Header.Get("Content-Type")
	if resp.StatusCode == 200 && len(body) > 512 {
		return body, ct
	}
	if DefaultImage() == "" {
		return []byte(""), ct
	}
	if url == DefaultImage() {
		panic("Catching an infinite loop! Default Image doesn't exist or is broken. Please rectify!")
	}
	return get(DefaultImage())
}
func NewImage(url string) string {
	return FromRemote(url)
}
func FromRemote(url string) string {
	image, mime := get(cleanUrl(url))
	enc := encode(image)
	out := format(enc, mime)
	return out
}
func FromBuffer(buf bytes.Buffer) string {
	enc := encode(buf.Bytes())
	mime := http.DetectContentType(buf.Bytes())
	return format(enc, mime)
}