当前位置: 首页>>代码示例>>PHP>>正文


PHP Filesystem::addPlugin方法代码示例

本文整理汇总了PHP中League\Flysystem\Filesystem::addPlugin方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::addPlugin方法的具体用法?PHP Filesystem::addPlugin怎么用?PHP Filesystem::addPlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在League\Flysystem\Filesystem的用法示例。


在下文中一共展示了Filesystem::addPlugin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getFilesystem

 /**
  * @return Filesystem
  */
 public function getFilesystem()
 {
     if ($this->filesystem == null) {
         $this->filesystem = new Filesystem(new Local($this->path));
         $this->filesystem->addPlugin(new ListFiles());
     }
     return $this->filesystem;
 }
开发者ID:mayconbordin,项目名称:l5-fixtures,代码行数:11,代码来源:FixturesMetadata.php

示例2: boot

 public function boot()
 {
     Storage::extend('qiniu', function ($app, $config) {
         $client = new QiniuAdapter($config['accessKey'], $config['secretKey'], $config['bucket'], $config['domain'], $config['notify_url'], $config['pipeline']);
         $filesystem = new Filesystem($client);
         $filesystem->addPlugin(new UploadToken());
         $filesystem->addPlugin(new PersistentStatus());
         $filesystem->addPlugin(new PersistentFop());
         $filesystem->addPlugin(new PrivateDownloadUrl());
         $filesystem->addPlugin(new VerifyCallback());
         return $filesystem;
     });
 }
开发者ID:hinet,项目名称:flysystem-qiniu,代码行数:13,代码来源:QiniuServiceProvider.php

示例3: boot

 public function boot()
 {
     Storage::extend('oss', function ($app, $config) {
         $ossconfig = ['AccessKeyId' => $config['access_id'], 'AccessKeySecret' => $config['access_key']];
         if (isset($config['endpoint']) && !empty($config['endpoint'])) {
             $ossconfig['Endpoint'] = $config['endpoint'];
         }
         $client = new \ALIOSS($ossconfig['AccessKeyId'], $ossconfig['AccessKeySecret'], $ossconfig['Endpoint']);
         $filesystem = new Filesystem(new AliyunOssAdapter($client, $config['bucket'], $config['prefix']));
         $filesystem->addPlugin(new initMultiUpload());
         $filesystem->addPlugin(new mergeMultiInfo());
         $filesystem->addPlugin(new uploadMultiPart());
         $filesystem->addPlugin(new finishMultiUpload());
         return $filesystem;
     });
 }
开发者ID:foxkillerli,项目名称:laravel-aliyun-oss,代码行数:16,代码来源:AliyunOssServiceProvider.php

示例4: __construct

 /**
  * @param array $settings
  * @param \League\Flysystem\AdapterInterface $adapter
  */
 public function __construct(array $settings, AdapterInterface $adapter = null)
 {
     $adapter = $adapter ?: $this->createAdapter($settings);
     $filesystem = new Filesystem($adapter, $settings);
     $filesystem->addPlugin(new ListFiles());
     $this->filesystem = $filesystem;
 }
开发者ID:flamecore,项目名称:synchronizer-files,代码行数:11,代码来源:FlysystemFilesLocation.php

示例5: boot

 public function boot()
 {
     Storage::extend('bos', function ($app, $config) {
         $client = new BosClient($config['options']);
         $filesystem = new Filesystem(new BaiduBosAdapter($client, $config['bucket']));
         $filesystem->addPlugin(new PutFilePlugin());
         return $filesystem;
     });
 }
开发者ID:zhuxiaoqiao,项目名称:laravel-baidu-bos,代码行数:9,代码来源:BaiduBosFilesystemServiceProvider.php

示例6: boot

 public function boot()
 {
     \Storage::extend('qiniu', function ($app, $config) {
         $qiniu_adapter = new QiniuAdapter($config['access_key'], $config['secret_key'], $config['bucket'], $config['domain']);
         $file_system = new Filesystem($qiniu_adapter);
         $file_system->addPlugin(new PrivateDownloadUrl());
         $file_system->addPlugin(new DownloadUrl());
         $file_system->addPlugin(new ImageInfo());
         $file_system->addPlugin(new ImageExif());
         $file_system->addPlugin(new ImagePreviewUrl());
         $file_system->addPlugin(new PersistentFop());
         $file_system->addPlugin(new PersistentStatus());
         $file_system->addPlugin(new UploadToken());
         $file_system->addPlugin(new Fetch());
         $file_system->addPlugin(new PutFile());
         return $file_system;
     });
 }
开发者ID:skyling,项目名称:laravel-qiniu,代码行数:18,代码来源:QiniuFilesystemServiceProvider.php

示例7: init

 /**
  * @inheritdoc
  */
 protected function init()
 {
     $this->fs = $this->options['filesystem'];
     if (!$this->fs instanceof FilesystemInterface && !$this->fs instanceof \creocoder\flysystem\Filesystem) {
         return $this->setError('A filesystem instance is required');
     }
     $this->fs->addPlugin(new UrlPlugin());
     isset($this->options['icon']) ?: ($this->options['icon'] = $this->getIcon());
     $this->root = $this->options['path'];
     if ($this->options['glideURL']) {
         $this->urlBuilder = UrlBuilderFactory::create($this->options['glideURL'], $this->options['glideKey']);
     }
     if ($this->options['imageManager']) {
         $this->imageManager = $this->options['imageManager'];
     } else {
         $this->imageManager = new ImageManager();
     }
     return true;
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:22,代码来源:FlysystemDriver.php

示例8: boot

 /**
  * Perform post-registration booting of services.
  *
  * @return void
  */
 public function boot()
 {
     Storage::extend('oss', function ($app, $config) {
         $accessId = $config['access_id'];
         $accessKey = $config['access_key'];
         $endPoint = $config['endpoint'];
         $bucket = $config['bucket'];
         $prefix = null;
         if (isset($config['prefix'])) {
             $prefix = $config['prefix'];
         }
         $client = new OssClient($accessId, $accessKey, $endPoint);
         $adapter = new AliyunOssAdapter($client, $bucket, $prefix);
         $filesystem = new Filesystem($adapter);
         $filesystem->addPlugin(new PutFile());
         $filesystem->addPlugin(new SignedDownloadUrl());
         return $filesystem;
     });
 }
开发者ID:apollopy,项目名称:flysystem-aliyun-oss,代码行数:24,代码来源:AliyunOssServiceProvider.php

示例9: boot

 public function boot()
 {
     class_alias('Illuminate\\Support\\Facades\\Storage', 'Storage');
     //for Lumen5.2
     \Storage::extend('qiniu', function ($app, $config) {
         $qiniu_adapter = new QiniuAdapter($config['access_key'], $config['secret_key'], $config['bucket'], $config['domain'], $config['pipeline'], $config['notify_url']);
         $file_system = new Filesystem($qiniu_adapter);
         $file_system->addPlugin(new PrivateDownloadUrl());
         $file_system->addPlugin(new DownloadUrl());
         $file_system->addPlugin(new ImageInfo());
         $file_system->addPlugin(new ImageExif());
         $file_system->addPlugin(new ImagePreviewUrl());
         $file_system->addPlugin(new PersistentFop());
         $file_system->addPlugin(new PersistentStatus());
         $file_system->addPlugin(new UploadToken());
         $file_system->addPlugin(new PutFile());
         $file_system->addPlugin(new Put());
         return $file_system;
     });
 }
开发者ID:abcsun,项目名称:qiniu-laravel-storage,代码行数:20,代码来源:QiniuFilesystemServiceProvider.php

示例10: boot

 public function boot()
 {
     Storage::extend('qiniu', function ($app, $config) {
         $qiniu_adapter = new QiniuAdapter($config['access_key'], $config['secret_key'], $config['buckets'], $config['notify_url'] ? $config['notify_url'] : null);
         $file_system = new Filesystem($qiniu_adapter);
         $plugins = [PrivateDownloadUrl::class, DownloadUrl::class, ImageExif::class, ImageInfo::class, ImagePreviewUrl::class, PersistentFop::class, PersistentStatus::class, WithBucket::class, ToBucket::class, UploadToken::class];
         foreach ($plugins as $plugin) {
             $file_system->addPlugin(new $plugin());
         }
         return $file_system;
     });
 }
开发者ID:silentred,项目名称:lumen-qiniu-storage,代码行数:12,代码来源:QiniuFilesystemServiceProvider.php

示例11: __construct

 public function __construct(AdapterInterface $local, AdapterInterface $remote)
 {
     // Remember the local root path
     $this->localRootPath = $local->getPathPrefix();
     // Create the local filesystem
     $local = new Filesystem($local);
     $local->addPlugin(new ListWith());
     $this->localFilesystem = $local;
     // The remote filesystem
     $remote = new Filesystem($remote);
     // Create the manager with the local and remote filesystems
     $this->manager = new MountManager(compact('local', 'remote'));
 }
开发者ID:antoineaugusti,项目名称:pdfarchiver,代码行数:13,代码来源:Mover.php

示例12: setUp

 public function setUp()
 {
     parent::setUp();
     // Set backend
     $adapter = new AssetAdapter(ASSETS_PATH . '/DBFileTest');
     $filesystem = new Filesystem($adapter);
     $filesystem->addPlugin(new FlysystemUrlPlugin());
     $backend = new AssetStoreTest_SpyStore();
     $backend->setFilesystem($filesystem);
     Injector::inst()->registerService($backend, 'AssetStore');
     // Disable legacy
     Config::inst()->remove(get_class(new FlysystemAssetStore()), 'legacy_filenames');
     // Update base url
     Config::inst()->update('Director', 'alternate_base_url', '/mysite/');
 }
开发者ID:sledziator,项目名称:silverstripe-framework,代码行数:15,代码来源:DBFileTest.php

示例13: __construct

 public function __construct($name = null, array $data = [], $dataName = '')
 {
     parent::__construct($name, $data, $dataName);
     /*
      * TODO 测试依赖
      */
     $accessId = 'you access id';
     $accessKey = 'you access key';
     $endPoint = 'oss-cn-beijing.aliyuncs.com';
     $bucket = 'you bucket';
     $client = new OssClient($accessId, $accessKey, $endPoint);
     $adapter = new AliyunOssAdapter($client, $bucket);
     $adapter->deleteDir('test');
     $adapter->setPathPrefix('test');
     $filesystem = new Filesystem($adapter);
     $filesystem->addPlugin(new PutFile());
     $this->filesystem = $filesystem;
 }
开发者ID:apollopy,项目名称:flysystem-aliyun-oss,代码行数:18,代码来源:AliyunOssAdapterTest.php

示例14: boot

 public function boot()
 {
     \Storage::extend('qiniu', function ($app, $config) {
         if (isset($config['domains'])) {
             $domains = $config['domains'];
         } else {
             $domains = ['default' => $config['domain'], 'https' => null, 'custom' => null];
         }
         $qiniu_adapter = new QiniuAdapter($config['access_key'], $config['secret_key'], $config['bucket'], $domains, $config['notify_url']);
         $file_system = new Filesystem($qiniu_adapter);
         $file_system->addPlugin(new PrivateDownloadUrl());
         $file_system->addPlugin(new DownloadUrl());
         $file_system->addPlugin(new ImageInfo());
         $file_system->addPlugin(new ImageExif());
         $file_system->addPlugin(new ImagePreviewUrl());
         $file_system->addPlugin(new PersistentFop());
         $file_system->addPlugin(new PersistentStatus());
         $file_system->addPlugin(new UploadToken());
         return $file_system;
     });
 }
开发者ID:frankstar007,项目名称:multiStorage,代码行数:21,代码来源:QiniuFilesystemServiceProvider.php

示例15: getResources

function getResources($uploads_dir, $id, $maxWidth, $connection = 'default')
{
    $attachments = Attachment::on($connection)->where('id', $id)->get();
    if (count($attachments) == 1) {
        $attachment = $attachments[0];
        switch ($attachment->source) {
            case Source::EMAIL:
                $adapter = new Local($uploads_dir . '/email/');
                break;
            case Source::TWITTER:
                $adapter = new Local($uploads_dir . '/twitter/');
                break;
            case Source::TELEGRAM:
                $adapter = new Local($uploads_dir . '/telegram/');
                break;
            default:
                break;
        }
        $filesystem = new Filesystem($adapter);
        $filesystem->addPlugin(new ListWith());
        if ($filesystem->has($attachment->filePath)) {
            $data = $filesystem->read($attachment->filePath);
            $fp['data'] = $data;
            $fp['mime'] = $filesystem->getMimetype($attachment->filePath);
            if ($maxWidth > 0) {
                $imagine = new \Imagine\Gd\Imagine();
                $image = $imagine->load($data);
                $size = $image->getSize();
                if ($size->getWidth() > $maxWidth) {
                    // AWIDTH : AHEIGHT = NWIDTH : NHEIGHT
                    // HHEIGHT = AHEIGHT * NWIDTH / AWIDTH
                    $height = $size->getHeight() * $maxWidth / $size->getWidth();
                    $width = $maxWidth;
                    $fp['data'] = $image->resize(new Box($width, $height), ImageInterface::FILTER_UNDEFINED)->show('png');
                    //FILTER_QUADRATIC
                }
            }
            return $fp;
        }
    }
    return false;
}
开发者ID:BitPrepared,项目名称:OnlineOnsiteOngoing,代码行数:42,代码来源:functions.image.php


注:本文中的League\Flysystem\Filesystem::addPlugin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。