base64 encode the image