|
|
@ -9,6 +9,7 @@ import java.io.OutputStream;
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
|
|
|
import java.util.Base64;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
|
@ -316,4 +317,28 @@ public class FileUtils
|
|
|
|
throw new ServiceException(imageName + " :Base64转图片错误");
|
|
|
|
throw new ServiceException(imageName + " :Base64转图片错误");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String GenerateImage(String imgStr)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Base64.Decoder decoder = Base64.getDecoder();
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Base64解码
|
|
|
|
|
|
|
|
byte[] b = decoder.decode(imgStr);
|
|
|
|
|
|
|
|
for (int i = 0; i < b.length; ++i)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (b[i] < 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
b[i] += 256;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return writeImportBytes(b);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new ServiceException("Base64转图片错误,message is " + e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|