问题描述
解决方案
static String getImageBinary(){
File f = new File(request.getParameter("图片的URL"));
BufferedImage bi;
try {
bi = ImageIO.read(f);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(bi, "jpg", baos);
byte[] bytes = baos.toByteArray();
return encoder.encodeBuffer(bytes).trim();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
解决方案二:
sorry,request.getParameter 给去了谢谢
时间: 2024-11-01 04:59:50