コード例 #1
0
 protected function generate($generate = false)
 {
     if (!empty($this->data) && $generate === false) {
         return $this->data;
     }
     $this->provider->build($this->width, $this->height);
     $this->code = $this->provider->getPhrase();
     return $this->data = ['mimeType' => 'image/jpeg', 'image' => $this->provider->get($this->quality)];
 }
コード例 #2
0
 protected function renderImage($code)
 {
     $builder = new CaptchaBuilder($code);
     $builder->setBackgroundColor(255, 255, 255);
     $builder->build(150, 40, $this->fontFile);
     return $builder->get();
 }
コード例 #3
0
 public static function create($phrase = null)
 {
     $builder = new CaptchaBuilder();
     if ($phrase) {
         $builder->setPhrase($phrase);
     }
     $builder->build();
     Session::put(static::$config['session'], Hash::make(Str::lower($builder->getPhrase())));
     return Response::make($builder->get())->header('Content-type', 'image/jpeg');
 }
コード例 #4
0
 public function display()
 {
     $builder = new CaptchaBuilder();
     $builder->build();
     $this->Session->write('captcha', $builder->getPhrase());
     $this->response->header('Content-type', 'image/jpeg');
     $this->response->body($builder->get());
     $this->response->send();
     return $this->response;
 }
コード例 #5
0
ファイル: HelloWorld.php プロジェクト: impress-php/impress
 public function getPic()
 {
     $builder = new CaptchaBuilder("31+8");
     $builder->build();
     return $this->response()->raw($builder->get(), 200, ['Content-type' => 'image/jpeg']);
 }
コード例 #6
0
 /**
  * Gets the image contents
  *
  * @access  public
  * @param   string  $quality  Image quality
  * @return  void
  */
 public function get($quality = 90)
 {
     return $this->builder->get($quality);
 }