-
composer.json
Open in GitHub{ "require": { "php": "^7.3", // "intervention/image": "^2" }, }
-
app/Http/Controllers/GroupCoverController.php
Open in GitHubuse Image; class GroupCoverController extends Controller { public function small(Group $group) { $this->authorize('view', $group); $path = storage_path().'/app/groups/'.$group->id.'/cover.jpg'; if (File::exists($path)) { $cachedImage = Image::cache(function ($img) use ($path) { return $img->make($path)->fit(128, 128); }, 5, true); return $cachedImage->response(); } else { abort(404); } } }