public function getTest2() { $this->layout = null; $img = Image::cache(function ($image) { $image->make('5721fc06d139a.jpg')->fit(300)->encode(null, 52); // $image->make('5721fc06d139a.jpg')->resize(300)->encode(null, 52); }, 12000, true); // $img = Image::make('5721fc06d139a.jpg')->resize(300, 300)->greyscale(); // $img = Image::make('5721fc06d139a.jpg')->crop(300, 300, 200, 600); // $img = Image::make('5721fc06d139a.jpg')->fit(400, 200); // echo $img->response(null, 10); // echo $img->fit(100,100)->response(null, 52); echo $img->response(); // echo "<pre>"; // print_r($img); // die; }
protected function thumbnails($template, $filename) { \Config::set('veer.image_templates.original', null); $image_path = public_path() . '/' . config('veer.images_path') . '/' . str_replace('..', '', $filename); if (!$this->checkTemplate($template) || !$this->checkFilename($image_path)) { return abort(404); } $params = config("veer.image_templates.{$template}"); if (!is_null($params)) { //image manipulation based on callback $content = Image::cache(function ($image) use($image_path, $params) { $img = $image->make($image_path); return $img->{array_get($params, 0, 'fit')}(array_get($params, 1), array_get($params, 2), function ($constraint) { $constraint->aspectRatio(); $constraint->upsize(); })->encode(null, 100); }, config('veer.image_lifetime')); } else { $content = file_get_contents($image_path); } $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $content); return response($content, 200, array('Content-Type' => $mime, 'Cache-Control' => 'max-age=' . config('veer.image_lifetime') * 60 . ', public', 'Etag' => md5($content))); }