예제 #1
1
 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('League\\Glide\\Server', function ($app) {
         $filesystem = $app->make('Illuminate\\Contracts\\Filesystem\\Filesystem');
         return \League\Glide\ServerFactory::create(['source' => storage_path(), 'cache' => storage_path(), 'source_path_prefix' => 'app/', 'cache_path_prefix' => 'app/.cache', 'base_url' => 'img']);
     });
 }
 public function boot()
 {
     $this->app->singleton('GlideApi', function () {
         $factory = new ServerFactory([]);
         return $factory->getApi();
     });
     if (!$this->app->routesAreCached()) {
         require __DIR__ . '/routes.php';
     }
 }
예제 #3
0
 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('League\\Glide\\Server', function ($app) {
         $server = ServerFactory::create(['response' => new LaravelResponseFactory(), 'source' => storage_path("app"), 'cache' => storage_path("framework/cache"), 'source_path_prefix' => "", 'cache_path_prefix' => ""]);
         return $server;
     });
 }
예제 #4
0
 /**
  * Callback for Routing.beforeDispatch event.
  *
  * @param \Cake\Event\Event $event The event instance.
  *
  * @return \Cake\Network\Response Response instance.
  */
 public function beforeDispatch(Event $event)
 {
     $request = $event->data['request'];
     $response = $event->data['response'];
     $path = urldecode($request->url);
     if (Configure::read('Glide.secureUrls')) {
         SignatureFactory::create(Security::salt())->validateRequest('/' . $path, $request->query);
     }
     $server = ServerFactory::create(Configure::read('Glide.serverConfig'));
     $cache = Configure::read('Glide.cache');
     if ($cache) {
         $timestamp = $server->getSource()->getTimestamp($server->getSourcePath($path));
         $response->modified($timestamp);
         if (!$response->checkNotModified($request)) {
             $response = $server->getImageResponse($path, $request->query);
         }
         $response->cache($timestamp, $cache);
     } else {
         $response = $server->getImageResponse($path, $request->query);
     }
     $headers = Hash::filter((array) Configure::read('Glide.headers'));
     foreach ($headers as $key => $value) {
         $response->header($key, $value);
     }
     return $response;
 }
예제 #5
0
 public function index(Request $request, $path)
 {
     // Setup Glide server
     $server = ServerFactory::create(['response' => new LaravelResponseFactory(), 'source' => storage_path(), 'cache' => storage_path('media/cache')]);
     // But, a better approach is to use information from the request
     $server->outputImage($path, $request->all());
 }
예제 #6
0
 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('League\\Glide\\Server', function ($app) {
         $filesystem = $app->make('Illuminate\\Contracts\\Filesystem\\Filesystem');
         return \League\Glide\ServerFactory::create(['source' => $filesystem->getDriver(), 'cache' => $filesystem->getDriver(), 'source_path_prefix' => '/' . public_path() . 'uploads', 'cache_path_prefix' => public_path() . '/uploads/.cache', 'base_url' => 'image']);
     });
 }
예제 #7
0
 /**
  * [glideServer description]
  * @return [type] [description]
  */
 private function glideServer()
 {
     $this->app->singleton(Server::class, function ($app) {
         $filesystem = $app->make(Filesystem::class);
         return ServerFactory::create(['source' => $filesystem->getDriver(), 'source_path_prefix' => '', 'cache' => $filesystem->getDriver(), 'cache_path_prefix' => '.cache']);
     });
 }
예제 #8
0
 /**
  * Register any application services.
  *
  * This service provider is a great spot to register your various container
  * bindings with the application. As you can see, we are registering our
  * "Registrar" implementation here. You can add your own bindings too!
  *
  * @return void
  */
 public function register()
 {
     $this->app->bind('Illuminate\\Contracts\\Auth\\Registrar', 'App\\Services\\Registrar');
     $this->app->singleton('League\\Glide\\Server', function ($app) {
         $filesystem = $app->make('Illuminate\\Contracts\\Filesystem\\Filesystem');
         return \League\Glide\ServerFactory::create(['source' => Storage::disk('s3')->getDriver(), 'cache' => Storage::disk('local')->getDriver(), 'cache_path_prefix' => 'uploads/images/.cache', 'base_url' => 'img', 'useSecureURLs' => false]);
     });
 }
 /**
  * Creating Glide server and registering it to the containter.
  *
  * @return void
  */
 protected function registerGlideServer()
 {
     $this->app->singleton('League\\Glide\\Server', function ($app) {
         $filesystem = new Filesystem($this->getGlideAdapter());
         $cachesystem = new Filesystem(new Local(config('filesystems.disks.local.root')));
         return ServerFactory::create(['source' => $filesystem, 'cache' => $cachesystem, 'source_path_prefix' => '', 'cache_path_prefix' => 'medias/.cache']);
     });
 }
예제 #10
0
 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->bind('Illuminate\\Contracts\\Auth\\Registrar', 'App\\Services\\Registrar');
     $this->app->singleton('League\\Glide\\Server', function ($app) {
         $filesystem = $app->make('Illuminate\\Contracts\\Filesystem\\Filesystem');
         return ServerFactory::create(['source' => $filesystem->getDriver(), 'cache' => $filesystem->getDriver(), 'source_prefix_path' => public_path() . 'images', 'cache_prefix_path' => public_path() . 'images/.cache']);
     });
 }
예제 #11
0
 public function save($outputFile)
 {
     $sourceFileName = pathinfo($this->sourceFile, PATHINFO_BASENAME);
     $cacheDir = sys_get_temp_dir();
     $glideServer = ServerFactory::create(['source' => dirname($this->sourceFile), 'cache' => $cacheDir, 'driver' => config('laravel-glide.driver')]);
     $conversionResult = $cacheDir . '/' . $glideServer->makeImage($sourceFileName, $this->modificationParameters);
     rename($conversionResult, $outputFile);
     return $outputFile;
 }
예제 #12
0
 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     //
     $this->app->singleton('League\\Glide\\Server', function ($app) {
         $filesystem = $app->make('Illuminate\\Contracts\\Filesystem\\Filesystem');
         $cloudsystem = $app->make('Illuminate\\Contracts\\Filesystem\\Cloud');
         $system = env('IMAGE_GET') == 'local' ? $filesystem : $cloudsystem;
         return \League\Glide\ServerFactory::create(['source' => $system->getDriver(), 'cache' => $filesystem->getDriver(), 'source_path_prefix' => 'img', 'cache_path_prefix' => 'img/.cache', 'base_url' => 'img']);
     });
 }
예제 #13
0
 /**
  * Register any application services.
  *
  * This service provider is a great spot to register your various container
  * bindings with the application. As you can see, we are registering our
  * "Registrar" implementation here. You can add your own bindings too!
  *
  * @return void
  */
 public function register()
 {
     $this->app->bind('Illuminate\\Contracts\\Auth\\Registrar', 'App\\Services\\Registrar');
     if ($this->app->environment() == 'local') {
         $this->app->register('Laracasts\\Generators\\GeneratorsServiceProvider');
     }
     $this->app->singleton('League\\Glide\\Server', function ($app) {
         $filesystem = $app->make('Illuminate\\Contracts\\Filesystem\\Filesystem');
         return ServerFactory::create(['source' => $filesystem->getDriver(), 'cache' => $filesystem->getDriver(), 'source_path_prefix' => 'images', 'cache_path_prefix' => 'images/.cache', 'base_url' => 'img']);
     });
 }
예제 #14
0
 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     //register public URL for filesystem
     $this->app->singleton('filesystemPublicUrl', function () {
         return new FilesystemPublicUrlManager($this->app);
     });
     //register Glide image manipulation
     $this->app->singleton('League\\Glide\\Server', function ($app) {
         $filesystem = $app->make('Illuminate\\Contracts\\Filesystem\\Cloud');
         return ServerFactory::create(['source' => $filesystem->getDriver(), 'cache' => $filesystem->getDriver(), 'source_path_prefix' => '', 'cache_path_prefix' => '.cache']);
     });
 }
 /**
  * Register glide.
  */
 protected function registerGlide()
 {
     $this->app->singleton('\\League\\Glide\\Server', function ($app) {
         $fileSystem = $app->make(Filesystem::class);
         $uploadDir = config('laravelimage.uploadDir');
         // Set source filesystem
         $source = new LeagueFilesystem(new Local($uploadDir));
         // Set cache filesystem
         $cache = new LeagueFilesystem(new Local($fileSystem->getDriver()->getAdapter()->getPathPrefix() . '/laravel-image-cache'));
         // Setup glide server
         return ServerFactory::create(['source' => $source, 'cache' => $cache, 'base_url' => config('laravelimage.routePath') . '/' . basename($uploadDir), 'response' => new LaravelResponseFactory()]);
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->delegate(Server::class, function (ResponseFactoryInterface $responseFactory, ContentServerSettings $settings) {
             return ServerFactory::create(['source' => $settings->fileArchivePath(), 'cache' => $settings->imagesCachePath(), 'response' => new PsrResponseFactory($responseFactory->makeStream(), function ($stream) use($responseFactory) {
                 return $responseFactory->makeBody('', $stream);
             })]);
         })->share(Server::class)->delegate(ContentRepositoryInterface::class, function (ContentServerSettings $settings) {
             $urlBuilder = UrlBuilderFactory::create($settings->fileBaseUrl());
             return new ContentRepository($urlBuilder);
         })->share(ContentRepositoryInterface::class)->share(ContentServerSettings::class);
     });
 }
예제 #17
0
 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     View::composer('pins.show', function ($view) {
         if (Auth::check()) {
             $favorites = DB::table('favorites')->whereUserId(Auth::id())->lists('pin_id');
             $view->with('favorites', $favorites);
         }
     });
     $this->app->singleton('League\\Glide\\Server', function ($app) {
         $filesystem = $app->make('Illuminate\\Contracts\\Filesystem\\Filesystem');
         return \League\Glide\ServerFactory::create(['source' => $filesystem->getDriver(), 'cache' => $filesystem->getDriver(), 'source_path_prefix' => 'images', 'cache_path_prefix' => 'images/.cache', 'base_url' => 'images']);
     });
 }
 /**
  * Register bindings in the container.
  */
 public function register()
 {
     $this->mergeConfigFrom(__DIR__ . '/../config/clyde.php', 'clyde');
     $this->app->singleton('laravel-clyde-server', function ($app) {
         $files = $app->make(Filesystem::class);
         return ServerFactory::create(['source' => $files->disk(config('clyde.source'))->getDriver(), 'source_path_prefix' => config('clyde.source_path_prefix'), 'cache' => $files->disk(config('clyde.cache'))->getDriver(), 'cache_path_prefix' => config('clyde.cache_path_prefix'), 'watermarks' => $files->disk(config('clyde.watermarks'))->getDriver(), 'watermarks_path_prefix' => config('clyde.watermarks_path_prefix'), 'driver' => config('clyde.driver'), 'max_image_size' => config('clyde.max_image_size'), 'presets' => config('clyde.presets'), 'response' => new SymfonyResponseFactory()]);
     });
     $this->app->bind('laravel-clyde-image', function ($app) {
         return $app->make(ClydeImage::class);
     });
     $this->app->bind('laravel-clyde-upload', function ($app) {
         return $app->make(ClydeUpload::class);
     });
 }
예제 #19
0
 public function save($outputFile)
 {
     $sourceFileName = pathinfo($this->sourceFile, PATHINFO_BASENAME);
     $cacheDir = sys_get_temp_dir();
     $glideServerParameters = ['source' => dirname($this->sourceFile), 'cache' => $cacheDir, 'driver' => config('laravel-glide.driver')];
     if (isset($this->modificationParameters['mark'])) {
         $watermarkPathInfo = pathinfo($this->modificationParameters['mark']);
         $glideServerParameters['watermarks'] = $watermarkPathInfo['dirname'];
         $this->modificationParameters['mark'] = $watermarkPathInfo['basename'];
     }
     $glideServer = ServerFactory::create($glideServerParameters);
     $conversionResult = $cacheDir . '/' . $glideServer->makeImage($sourceFileName, isset($modificationParameters) ? $modificationParameters : $this->modificationParameters);
     rename($conversionResult, $outputFile);
     return $outputFile;
 }
예제 #20
0
 /**
  * Serve images.
  */
 private function serve()
 {
     $base = $this->base_url;
     $url = $_SERVER['REQUEST_URI'];
     $url = parse_url($url);
     $path = str_replace($base, '', $url['path']);
     $path = ltrim($path, '/');
     // Docs: http://glide.thephpleague.com/1.0/config/setup/
     $options = apply_filters('glide/options', ['source' => WP_CONTENT_DIR . '/uploads', 'cache' => WP_CONTENT_DIR . '/cache/glide', 'base_url' => $base]);
     if (file_exists(rtrim($options['source'], '/') . '/' . $path)) {
         status_header(200);
         $server = \League\Glide\ServerFactory::create($options);
         $server->outputImage($path, $_GET);
         die;
     }
     status_header(404);
     echo 'Image not found.';
     die;
 }
예제 #21
0
파일: Glide.php 프로젝트: haaseit/hcsf
 public function preparePage()
 {
     $sPath = implode('/', $this->aPath);
     $sImageroot = PATH_BASEDIR . HelperConfig::$core['directory_glide_master'];
     if (is_file($sImageroot . substr($sPath, strlen(HelperConfig::$core['directory_images']) + 1)) && getimagesize($sImageroot . substr($sPath, strlen(HelperConfig::$core['directory_images']) + 1))) {
         $glideserver = \League\Glide\ServerFactory::create(['source' => $sImageroot, 'cache' => PATH_GLIDECACHE, 'max_image_size' => HelperConfig::$core['glide_max_imagesize']]);
         $glideserver->setBaseUrl('/' . HelperConfig::$core['directory_images'] . '/');
         // Generate a URL
         try {
             // Validate HTTP signature
             \League\Glide\Signatures\SignatureFactory::create(HelperConfig::$secrets['glide_signkey'])->validateRequest($sPath, $_GET);
             $glideserver->outputImage($sPath, $_GET);
             die;
         } catch (\League\Glide\Signatures\SignatureException $e) {
             $this->P = 404;
         }
     } else {
         $this->P = 404;
     }
     return $this->P;
 }
예제 #22
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
//Route::get('elfinder','Barryvdh\elfinder\ElfinderController@showConnector');
Route::get('elfinder', 'Barryvdh\\elfinder\\ElfinderController@showTinyMCE4');
Route::get('/', function () {
    return view('welcome');
});
Route::resource('editor', 'ElfinderController');
Route::get('editore', 'ElfinderController@editore');
//Route::get('editor2','ElfinderController@editor2');
#Route::get("disk");
Route::get('glide/{path}', function ($path) {
    $server = \League\Glide\ServerFactory::create(['source' => app('filesystem')->disk('public')->getDriver(), 'cache' => storage_path('glide')]);
    return $server->getImageResponse($path, Input::query());
})->where('path', '.+');
// Route::get('/elfinder/tinymce','Barryvdh\Elfinder\ElfinderController@showTinyMCE4');
#Route::get('elfinder','ElfinderController@showConnector');
예제 #23
0
 public function testCreate()
 {
     $server = ServerFactory::create(['source' => Mockery::mock('League\\Flysystem\\FilesystemInterface'), 'cache' => Mockery::mock('League\\Flysystem\\FilesystemInterface'), 'response' => Mockery::mock('League\\Glide\\Responses\\ResponseFactoryInterface')]);
     $this->assertInstanceOf('League\\Glide\\Server', $server);
 }
예제 #24
0
파일: routes.php 프로젝트: simple-cms/media
<?php

use Illuminate\Http\Request;
use League\Glide\ServerFactory;
Route::group(['prefix' => config('core.adminURL')], function () {
    Route::resource(config('asset.assetURL'), 'SimpleCms\\Asset\\AdminController');
});
Route::get('asset/{slug}', function (Request $request) {
    return ServerFactory::create(config('asset.glideConfiguration'))->outputImage($request);
});
예제 #25
0
 /**
  * Server factory
  * @param array $config
  * @return \Studiow\GlideFormat\GlideFormatServer
  */
 public static function createServer(array $config)
 {
     $server = \League\Glide\ServerFactory::create($config);
     return new GlideFormatServer($server);
 }
예제 #26
0
 public function __construct(ServerFactory $serverFactory)
 {
     $this->server = $serverFactory->create(['source' => storage_path('uploads'), 'cache' => '/tmp/strimoid/glide/', 'driver' => config('image.driver')]);
     $this->server->setResponseFactory(new SymfonyResponseFactory());
 }
예제 #27
0
 public static function getGlideServer()
 {
     return \League\Glide\ServerFactory::create(['source' => Storage::disk('s3')->getDriver(), 'cache' => Storage::disk('local')->getDriver(), 'cache_path_prefix' => 'uploads/images/.cache', 'base_url' => 'img', 'useSecureURLs' => false]);
 }
예제 #28
0
 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton(Server::class, function ($app) {
         return ServerFactory::create(['response' => new LaravelResponseFactory(), 'source' => $app[Filesystem::class]->getDriver(), 'cache' => $app[Filesystem::class]->getDriver(), 'source_path_prefix' => 'images', 'cache_path_prefix' => 'images/.cache', 'base_url' => 'img']);
     });
 }
 /**
  * @return \League\Glide\Server
  */
 public function create()
 {
     return \League\Glide\ServerFactory::create($this->config);
 }
 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     # Estou registrando aqui o Glide (Image Manipulation)
     $this->app->singleton('League\\Glide\\Server', function ($app) {
         $filesystem = $app->make('Illuminate\\Contracts\\Filesystem\\Filesystem');
         return \League\Glide\ServerFactory::create(['source' => $filesystem->getDriver(), 'cache' => $filesystem->getDriver(), 'source_path_prefix' => 'images', 'cache_path_prefix' => 'images/.cache', 'base_url' => '/images/']);
     });
 }