小程序base64图片解析成流上传服务器


/**
*
* @Title: decodeBase64ToImage
* @Description: (將base64位的图片解码成流 上传到阿里云服务器)
* @param base64 图片的64进制码
* @param path 图片的本地生成地址
* @param imgName 图片名称
* @param uppath 图片的oss远程地址
* @param imgName void (这里描述输出参数的作用)
* @throws
* @author huyuhang
* @date 2019年3月12日 下午4:53:44
*/
public static void decodeBase64ToImage(String base64,String uppath) {
BASE64Decoder decoder = new BASE64Decoder();
byte[] decoderBytes;
try {
decoderBytes = decoder.decodeBuffer(base64);
ByteArrayInputStream inputStream = new ByteArrayInputStream(decoderBytes);
//上传到oss
if (uppath.startsWith("/")) {
uppath = uppath.substring(1);
}

//上传阿里云
//ossUtil.putObjectMethod(uppath,inputStream);
} catch (IOException e) {
e.printStackTrace();
}

}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM