Blob picture = cd.getCoverImage();
if(null!=picture){
try {
long size = picture.length();
byte[] bs = picture.getBytes(1, (int) size);
cover.addContent(Base64.encodeBytes(bs));
} catch (SQLException e) {
e.printStackTrace();
}
}
if(null!=picture){
try {
long size = picture.length();
byte[] bs = picture.getBytes(1, (int) size);
cover.addContent(Base64.encodeBytes(bs));
} catch (SQLException e) {
e.printStackTrace();
}
}
本文介绍了一种从Blob对象获取图片并将其转换为Base64编码字符串的方法。通过获取Blob对象中的图片数据,计算其长度,并使用Base64进行编码以便在网络中传输。
1万+

被折叠的 条评论
为什么被折叠?



