Noah Petherbridge
1a9706c09f
* Rework the Story Mode UI to display level thumbnails. * Responsive UI: defaults to wide screen mode and shows 3 levels horizontally but on narrow/mobile display, shows 2 levels per page in portrait. * Add "Tiny" screenshot size (224x126) to fit the Story Mode UI. * Make the pager buttons bigger and more touchable. * Maximize the game window on startup unless the -w option with a specific window resolution is provided.
34 lines
584 B
Go
34 lines
584 B
Go
package wallpaper
|
|
|
|
import (
|
|
"encoding/base64"
|
|
"io/ioutil"
|
|
"os"
|
|
)
|
|
|
|
/*
|
|
Functions related to the ingest of custom Wallpaper images for user levels.
|
|
*/
|
|
|
|
// FileToB64 loads an image file from disk and returns the Base64 encoded
|
|
// file data, if it is a valid image and so on.
|
|
func FileToB64(filename string) (string, error) {
|
|
fh, err := os.Open(filename)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
defer fh.Close()
|
|
|
|
bin, err := ioutil.ReadAll(fh)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
b64 := base64.StdEncoding.EncodeToString(bin)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return b64, nil
|
|
}
|