MCPcopy Create free account
hub / github.com/f0ng/captcha-killer-modified / isImage

Method isImage

src/main/java/utils/Util.java:55–78  ·  view source on GitHub ↗
(String str_img,String words)

Source from the content-addressed store, hash-verified

53 }
54
55 public static boolean isImage(String str_img,String words) throws IOException {
56// System.out.println(str_img);
57 String pattern = "(" + words + ".*?)[,&}/+=\\w]+";
58 Pattern r = Pattern.compile(pattern);
59 Matcher m = r.matcher(str_img);
60 if (m.find( )) {
61 str_img = m.group(0).replace("\"","").replace("&","").replace("Base64:","").replace("base64:","") ;
62 }
63 if (!str_img.contains("data:image")){
64 str_img = "data:image/jpeg;base64," + str_img;
65 }
66
67 byte[] img = DatatypeConverter.parseBase64Binary(str_img.substring(str_img.indexOf(",") + 1));
68 boolean isImg = false;
69 InputStream buffin = new ByteArrayInputStream(img);
70 BufferedImage image = ImageIO.read(buffin);
71 if(image == null){
72 isImg = false;
73 }else {
74 isImg = true;
75 }
76// System.out.println(isImg);
77 return isImg;
78 }
79
80 public static boolean isImage(String str_img) throws IOException {
81// System.out.println(str_img);

Callers 2

actionPerformedMethod · 0.95
runMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected