Esempio n. 1
0
 /** Create
  * 
  * @return image response object
  * 
  * Creates the captcha response
  */
 public function create()
 {
     $this->image_type();
     $this->image_captcha();
     $this->image_font();
     $this->set_margins();
     $this->draw();
     $this->distort();
     $this->message();
     $response = new \Fuel\Core\Response();
     $response->set_header('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate');
     $response->set_header('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
     $response->set_header('Pragma', 'no-cache');
     if ($this->image_type === 'png') {
         $response->set_header('Content-Type', 'image/png');
         $response->body = imagepng($this->image_captcha);
     } else {
         if ($this->image_type === 'jpeg') {
             $response->set_header('Content-Type', 'image/jpeg');
             $response->body = imagejpeg($this->image_captcha);
         }
     }
     imagedestroy($this->image_captcha);
     return $response;
 }