[][src]Function serenity::utils::read_image

pub fn read_image<P: AsRef<Path>>(path: P) -> Result<String>

Reads an image from a path and encodes it into base64.

This can be used for methods like EditProfile::avatar.

Examples

Reads an image located at ./cat.png into a base64-encoded string:

use serenity::utils;

let image = utils::read_image("./cat.png").expect("Failed to read image");