小程序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