1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-30 09:10:21 +02:00

Laravel 6 / PHP7.3 compatibility

This commit is contained in:
Oliver Vogel
2019-11-02 10:15:47 +01:00
parent 39eaef720d
commit abbf18d5ab
2 changed files with 20 additions and 3 deletions

View File

@@ -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);

View File

@@ -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;
}
}