Exemplo n.º 1
0
 public function boot()
 {
     $configPath = __DIR__ . '/../config/snappy.php';
     $this->publishes([$configPath => config_path('snappy.php')], 'config');
     if ($this->app['config']->get('snappy.pdf.enabled')) {
         $this->app['snappy.pdf'] = $this->app->share(function ($app) {
             $binary = $app['config']->get('snappy.pdf.binary');
             $options = $app['config']->get('snappy.pdf.options');
             $timeout = $app['config']->get('snappy.pdf.timeout', false);
             $snappy = new IlluminateSnappyPdf($app['files'], $binary, $options);
             if (false !== $timeout) {
                 $snappy->setTimeout($timeout);
             }
             return $snappy;
         });
         $this->app['snappy.pdf.wrapper'] = $this->app->share(function ($app) {
             return new PdfWrapper($app['snappy.pdf']);
         });
     }
     if ($this->app['config']->get('snappy.image.enabled')) {
         $this->app['snappy.image'] = $this->app->share(function ($app) {
             $binary = $app['config']->get('snappy.image.binary');
             $options = $app['config']->get('snappy.image.options');
             $timeout = $app['config']->get('snappy.image.timeout', false);
             $image = new IlluminateSnappyImage($app['files'], $binary, $options);
             if (false !== $timeout) {
                 $image->setTimeout($timeout);
             }
             return $image;
         });
         $this->app['snappy.image.wrapper'] = $this->app->share(function ($app) {
             return new ImageWrapper($app['snappy.image']);
         });
     }
 }
Exemplo n.º 2
0
 public function boot()
 {
     $configPath = __DIR__ . '/../config/snappy.php';
     $this->publishes([$configPath => config_path('snappy.php')], 'config');
     if ($this->app['config']->get('snappy.pdf.enabled')) {
         $this->app['snappy.pdf'] = $this->app->share(function ($app) {
             $binary = $app['config']->get('snappy.pdf.binary', '/usr/local/bin/wkhtmltopdf');
             $options = $app['config']->get('snappy.pdf.options', array());
             $env = $app['config']->get('snappy.pdf.env', array());
             $timeout = $app['config']->get('snappy.pdf.timeout', false);
             $snappy = new IlluminateSnappyPdf($app['files'], $binary, $options, $env);
             if (false !== $timeout) {
                 $snappy->setTimeout($timeout);
             }
             return $snappy;
         });
         $this->app['snappy.pdf.wrapper'] = $this->app->share(function ($app) {
             return new PdfWrapper($app['snappy.pdf']);
         });
         $this->app->alias('snappy.pdf.wrapper', 'Barryvdh\\Snappy\\PdfWrapper');
     }
     if ($this->app['config']->get('snappy.image.enabled')) {
         $this->app['snappy.image'] = $this->app->share(function ($app) {
             $binary = $app['config']->get('snappy.image.binary', '/usr/local/bin/wkhtmltoimage');
             $options = $app['config']->get('snappy.image.options', array());
             $env = $app['config']->get('snappy.image.env', array());
             $timeout = $app['config']->get('snappy.image.timeout', false);
             $image = new IlluminateSnappyImage($app['files'], $binary, $options, $env);
             if (false !== $timeout) {
                 $image->setTimeout($timeout);
             }
             return $image;
         });
         $this->app['snappy.image.wrapper'] = $this->app->share(function ($app) {
             return new ImageWrapper($app['snappy.image']);
         });
         $this->app->alias('snappy.image.wrapper', 'Barryvdh\\Snappy\\ImageWrapper');
     }
 }