diff --git a/src/Bkwld/Croppa/ServiceProviderLaravel4.php b/src/Bkwld/Croppa/ServiceProviderLaravel4.php index 5eb0b21..29e5dbb 100644 --- a/src/Bkwld/Croppa/ServiceProviderLaravel4.php +++ b/src/Bkwld/Croppa/ServiceProviderLaravel4.php @@ -31,7 +31,10 @@ public function boot() { // Listen for Cropa style URLs, these are how Croppa gets triggered $croppa = $this->app['croppa']; $this->app->make('router')->get('{path}', function($path) use ($croppa) { - $croppa->generate($path); + $image = $croppa->generate($path); + return \Response::stream(function() use ($image) { + return $image->show(); + }); })->where('path', $croppa->directoryPattern()); } diff --git a/src/Bkwld/Croppa/ServiceProviderLaravel5.php b/src/Bkwld/Croppa/ServiceProviderLaravel5.php index ff28b94..6582329 100644 --- a/src/Bkwld/Croppa/ServiceProviderLaravel5.php +++ b/src/Bkwld/Croppa/ServiceProviderLaravel5.php @@ -39,7 +39,10 @@ public function boot() { // Listen for Cropa style URLs, these are how Croppa gets triggered $croppa = $this->app['croppa']; $this->app->make('router')->get('{path}', function($path) use ($croppa) { - $croppa->generate($path); + $image = $croppa->generate($path); + return \Response::stream(function() use ($image) { + return $image->show(); + }); })->where('path', $croppa->directoryPattern()); } }