diff --git a/src/Intervention/Image/ImageServiceProvider.php b/src/Intervention/Image/ImageServiceProvider.php index e106d06c..f99fe4a3 100644 --- a/src/Intervention/Image/ImageServiceProvider.php +++ b/src/Intervention/Image/ImageServiceProvider.php @@ -69,7 +69,7 @@ class ImageServiceProvider extends ServiceProvider } elseif (version_compare(IlluminateApplication::VERSION, '5.0', '<')) { $provider = '\Intervention\Image\ImageServiceProviderLaravel4'; } else { - $provider = '\Intervention\Image\ImageServiceProviderLaravel5'; + $provider = '\Intervention\Image\ImageServiceProviderLaravelRecent'; } return new $provider($this->app); diff --git a/src/Intervention/Image/ImageServiceProviderLaravel5.php b/src/Intervention/Image/ImageServiceProviderLaravelRecent.php similarity index 82% rename from src/Intervention/Image/ImageServiceProviderLaravel5.php rename to src/Intervention/Image/ImageServiceProviderLaravelRecent.php index dd40ebd9..8a9bc232 100644 --- a/src/Intervention/Image/ImageServiceProviderLaravel5.php +++ b/src/Intervention/Image/ImageServiceProviderLaravelRecent.php @@ -4,7 +4,7 @@ namespace Intervention\Image; use Illuminate\Support\ServiceProvider; -class ImageServiceProviderLaravel5 extends ServiceProvider +class ImageServiceProviderLaravelRecent extends ServiceProvider { /** * Determines if Intervention Imagecache is installed @@ -48,7 +48,7 @@ class ImageServiceProviderLaravel5 extends ServiceProvider // create image $app->singleton('image', function ($app) { - return new ImageManager($app['config']->get('image')); + return new ImageManager($this->getImageConfig($app)); }); $app->alias('image', 'Intervention\Image\ImageManager'); @@ -86,4 +86,21 @@ class ImageServiceProviderLaravel5 extends ServiceProvider ])->where(['filename' => $filename_pattern]); } } + + /** + * Return image configuration as array + * + * @param Application $app + * @return array + */ + private function getImageConfig($app) + { + $config = $app['config']->get('image'); + + if (is_null($config)) { + return []; + } + + return $config; + } }