path=数据库存放图片的路径
public static String imageToBase64(String path) {
InputStream in = null;
byte[] data = null;
try {
in = new FileInputStream(path);
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data);
}