-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from TypiCMS/master
PHPThumb replaced by Intervention Image
- Loading branch information
Showing
24 changed files
with
376 additions
and
612 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
namespace Bkwld\Croppa; | ||
|
||
use Bkwld\Croppa\Commands\Purge; | ||
use Illuminate\Support\ServiceProvider; | ||
|
||
class CroppaServiceProvider extends ServiceProvider | ||
{ | ||
public function register() | ||
{ | ||
// Bind the Croppa URL generator and parser. | ||
$this->app->singleton(URL::class, function ($app) { | ||
return new URL($this->getConfig()); | ||
}); | ||
|
||
// Handle the request for an image, this coordinates the main logic. | ||
$this->app->singleton(Handler::class, function ($app) { | ||
return new Handler( | ||
$app[URL::class], | ||
$app[Storage::class], | ||
$app['request'], | ||
$this->getConfig() | ||
); | ||
}); | ||
|
||
// Interact with the disk. | ||
$this->app->singleton(Storage::class, function ($app) { | ||
return new Storage($app, $this->getConfig()); | ||
}); | ||
|
||
// API for use in apps. | ||
$this->app->singleton(Helpers::class, function ($app) { | ||
return new Helpers($app[URL::class], $app[Storage::class], $app[Handler::class]); | ||
}); | ||
|
||
// Register command to delete all crops. | ||
$this->app->singleton(Purge::class, function ($app) { | ||
return new Purge($app[Storage::class]); | ||
}); | ||
|
||
$this->commands(Purge::class); | ||
} | ||
|
||
public function boot() | ||
{ | ||
$this->mergeConfigFrom(__DIR__.'/../../config/config.php', 'croppa'); | ||
$this->publishes([__DIR__.'/../../config/config.php' => config_path('croppa.php')], 'croppa-config'); | ||
|
||
$this->app['router'] | ||
->get('{path}', 'Bkwld\Croppa\Handler@handle') | ||
->where('path', $this->app[URL::class]->routePattern()); | ||
} | ||
|
||
/** | ||
* Get the configuration. | ||
* | ||
* @return array | ||
*/ | ||
public function getConfig() | ||
{ | ||
$config = $this->app->make('config')->get('croppa'); | ||
|
||
// Use Laravel’s encryption key if instructed to. | ||
if (isset($config['signing_key']) && $config['signing_key'] === 'app.key') { | ||
$config['signing_key'] = $this->app->make('config')->get('app.key'); | ||
} | ||
|
||
return $config; | ||
} | ||
} |
6 changes: 4 additions & 2 deletions
6
src/Bkwld/Croppa/Facade.php → src/Bkwld/Croppa/Facades/Croppa.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.