/** * 获取教务处验证码 * 地址http://210.42.38.26:81/jwc_glxt/ValidateCode.aspx * @param type $path 验证码存储地址 */ public function getCheckCode($path = NULL) { $url = "http://210.42.38.26:81/jwc_glxt/ValidateCode.aspx"; $im = imagecreatefromjpeg($url); if ($path && $path != "") { YImageTool::save($im, $path); } else { if ($im) { return $im; } } }
public function discernCheckCode() { $fileArray = File::getFileName($this->dataPath); $main = new MyMain(); $im = $main->getCheckCode(); $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(); 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; }
public function printImage() { YImageTool::printImage($this->Iresource); }