Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 /**
  * 比较相同文件夹下的文件
  * @param type $fileArray
  */
 public function compare1($fileArray)
 {
     $filearrayLen = count($fileArray);
     for ($x = 0; $x < $filearrayLen; $x++) {
         $image = new YImage(imagecreatefromjpeg("./image/data/{$fileArray[$x]}.jpg"));
         $image->quzhao();
         for ($y = $x + 1; $y < $filearrayLen; $y++) {
             $image1 = new YImage(imagecreatefromjpeg("./image/data/{$fileArray[$y]}.jpg"));
             $image1->quzhao();
             if ($image->compare1($image1->getDataAray())) {
                 echo "{$fileArray[$x]}=>{$fileArray[$y]}";
                 echo "<br/>";
             }
         }
     }
 }