public class ImageUtil {
/**
* 获取 base64 编码后的图片内容(字符串表示)
* @param imageURL 网络图片地址
* @return 图片内容
*/
public static String getBase64EncodedImage(String imageURL) throws IOException {
URL url = new URL(imageURL);
InputStream is = url.openStream();
byte[] bytes = IOUtils.toByteArray(is);
return Base64.encodeBase64String(bytes);
}
}
