Beispiel #1
0
 function image()
 {
     $bgcontent = $this->background();
     if ($this->animator == 1 && function_exists('imagegif')) {
         include_once $this->includepath . 'class_gifmerge.php';
         $trueframe = mt_rand(1, 9);
         for ($i = 0; $i <= 9; $i++) {
             $this->im = imagecreatefromstring($bgcontent);
             $x[$i] = $y[$i] = 0;
             $this->adulterate && $this->adulterate();
             if ($i == $trueframe) {
                 $this->ttf && function_exists('imagettftext') || $this->type == 1 ? $this->ttffont() : $this->giffont();
                 $d[$i] = mt_rand(250, 400);
                 $this->scatter && $this->scatter($this->im);
             } else {
                 $this->adulteratefont();
                 $d[$i] = mt_rand(5, 15);
                 $this->scatter && $this->scatter($this->im, 1);
             }
             ob_start();
             imagegif($this->im);
             imagedestroy($this->im);
             $frame[$i] = ob_get_contents();
             ob_end_clean();
         }
         $anim = new GifMerge($frame, 255, 255, 255, 0, $d, $x, $y, 'C_MEMORY');
         header('Content-type: image/gif');
         echo $anim->getAnimation();
     } else {
         $this->im = imagecreatefromstring($bgcontent);
         $this->adulterate && $this->adulterate();
         $this->ttf && function_exists('imagettftext') || $this->type == 1 ? $this->ttffont() : $this->giffont();
         $this->scatter && $this->scatter($this->im);
         if (function_exists('imagepng')) {
             header('Content-type: image/png');
             imagepng($this->im);
         } else {
             header('Content-type: image/jpeg');
             imagejpeg($this->im, '', 100);
         }
         imagedestroy($this->im);
     }
 }
Beispiel #2
0
 public function merge()
 {
     if ($handle = opendir($this->path)) {
         $c = 0;
         $files = array();
         while (false !== ($file = readdir($handle))) {
             if (!is_file($this->path . $file)) {
                 continue;
             }
             $files[] = realpath($this->path . $file);
             $c++;
         }
         sort($files);
         closedir($handle);
     }
     //http://d.hatena.ne.jp/shimooka/20060914/1158209427
     $d = array_fill(0, $c, 5);
     $x = array_fill(0, $c, 0);
     $y = array_fill(0, $c, 0);
     $anim = new GifMerge($files, 255, 255, 255, 0, $d, $x, $y, 'C_FILE');
     header('Content-type: image/gif');
     echo $anim->getAnimation();
 }
Beispiel #3
0
         $x[$i] = $y[$i] = 0;
         $seccodedata['adulterate'] && seccode_adulterate();
         if ($i == $trueframe) {
             $seccodedata['ttf'] && function_exists('imagettftext') || $seccodedata['type'] == 1 ? seccode_ttffont() : seccode_giffont();
             $d[$i] = mt_rand(250, 400);
         } else {
             seccode_adulteratefont();
             $d[$i] = mt_rand(5, 15);
         }
         ob_start();
         imagegif($im);
         imagedestroy($im);
         $frame[$i] = ob_get_contents();
         ob_end_clean();
     }
     $anim = new GifMerge($frame, 255, 255, 255, 0, $d, $x, $y, 'C_MEMORY');
     dheader('Content-type: image/gif');
     echo $anim->getAnimation();
 } else {
     $im = imagecreatefromstring($bgcontent);
     $seccodedata['adulterate'] && seccode_adulterate();
     $seccodedata['ttf'] && function_exists('imagettftext') || $seccodedata['type'] == 1 ? seccode_ttffont() : seccode_giffont();
     if (function_exists('imagepng')) {
         dheader('Content-type: image/png');
         imagepng($im);
     } else {
         dheader('Content-type: image/jpeg');
         imagejpeg($im, '', 100);
     }
     imagedestroy($im);
 }
Beispiel #4
0
 function image()
 {
     $bgcontent = $this->background();
     header("Cache-Control: no-cache, must-revalidate");
     // HTTP/1.1
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     // Date in the past
     if ($this->animator == 1 && function_exists('imagegif')) {
         import('gifmerge.lib');
         $trueframe = mt_rand(1, 9);
         for ($i = 0; $i <= 9; $i++) {
             $this->im = imagecreatefromstring($bgcontent);
             $x[$i] = $y[$i] = 0;
             $this->adulterate && $this->adulterate();
             if ($i == $trueframe) {
                 $this->ttf && function_exists('imagettftext') ? $this->ttffont() : $this->giffont();
                 $d[$i] = mt_rand(250, 400);
             } else {
                 $this->adulteratefont();
                 $d[$i] = mt_rand(5, 15);
             }
             ob_start();
             imagegif($this->im);
             imagedestroy($this->im);
             $frame[$i] = ob_get_contents();
             ob_end_clean();
         }
         $anim = new GifMerge($frame, 255, 255, 255, 0, $d, $x, $y, 'C_MEMORY');
         header('Content-type: image/gif');
         echo $anim->getAnimation();
     } else {
         $this->im = imagecreatefromstring($bgcontent);
         $this->adulterate && $this->adulterate();
         $this->ttf && function_exists('imagettftext') ? $this->ttffont() : $this->giffont();
         if (function_exists('imagepng')) {
             header('Content-type: image/png');
             imagepng($this->im);
         } else {
             header('Content-type: image/jpeg');
             imagejpeg($this->im, '', 100);
         }
         imagedestroy($this->im);
     }
 }
Beispiel #5
0
 private static function _outGif()
 {
     header("Pragma:no-cache");
     header("Cache-control:no-cache");
     header("Content-type: image/gif");
     Wind::import('LIB:utility.verifycode.GifMerge');
     self::_getCodeLenth();
     self::_setRandBackground();
     self::_setRandFont();
     for ($i = 0; $i < 3; $i++) {
         self::_creatImage();
         self::_creatBackground();
         self::_setRandGraph();
         self::_writeImage();
         ob_start();
         imageGif(self::$_image);
         $frame[] = ob_get_contents();
         $delay[] = 100;
         imagedestroy(self::$_image);
         ob_end_clean();
     }
     $gif = new GifMerge($frame, 0, 0, 0, 0, $delay, 0, 0, 'C_MEMORY');
     echo $gif->getAnimation();
 }