-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcheckcode.class.php
More file actions
40 lines (30 loc) · 1.11 KB
/
checkcode.class.php
File metadata and controls
40 lines (30 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
class CheckCode {
private $codeLenth = 4;
private $tempFile = "./image/temp.jpg";
private $dataPath = "./image/data/";
private $checkCode = "";
public function discernCheckCode($url) {
$fileArray = File::getFileName($this->dataPath);
$main = new MyMain();
$im = $main->getCheckCode($url);
$imageArray = $main->getImageArray($im);
YImageTool::save($im, $this->tempFile);
for ($index = 0; $index < $this->codeLenth; $index++) {
$image = new YImage($imageArray[$index]);
$image->quzhao();
$image = $image->getDataAray();
//var_dump($image);exit;
foreach ($fileArray as $value) {
$im = imagecreatefromjpeg($this->dataPath . "" . $value . ".jpg");
$tagImage = new YImage($im);
$tagImage->quzhao();
if ($tagImage->compare($image)) {
$this->checkCode = $this->checkCode . substr_replace($value, '', 1);
break;
}
}
}
return $this->checkCode;
}
}