Thumb::create PHP Method

create() protected method

Calls the driver function and creates the thumbnail
protected create ( )
    protected function create()
    {
        return call_user_func_array(static::$drivers[$this->options['driver']], array($this));
    }

Usage Example

示例#1
0
文件: thumb.php 项目: greor/satin-spb
 public function action_index()
 {
     $group = $this->request->param('group');
     if (!$group) {
         throw new HTTP_Exception_404();
     }
     $config = Kohana::$config->load('thumb')->get($group);
     if (!$config) {
         throw new HTTP_Exception_404();
     }
     $file = $this->request->param('file');
     if (!$file) {
         throw new HTTP_Exception_404();
     }
     $path = Arr::get($config, 'path', '');
     if (!empty($path)) {
         $path = rtrim($path, '/') . '/';
     }
     $thumb = Thumb::create($group, $path . $file);
     if ($thumb) {
         // Get the extension from the filename
         $ext = strtolower(pathinfo($thumb, PATHINFO_EXTENSION));
         $mime = File::mime_by_ext($ext);
         $this->response->headers('Content-Type', $mime ? $mime : 'image/jpeg');
         $this->response->body(file_get_contents($thumb));
     } else {
         throw new HTTP_Exception_500();
     }
 }
All Usage Examples Of Thumb::create