Local example


    private $filesystem;

    public function __construct(
        OptimizerServiceInterface $optimizerService,
        MediaServiceInterface $mediaService,
        ?FilesystemInterface $filesystem = null
    ) {
        $this->optimizerService = $optimizerService;
        $this->mediaService = $mediaService;
        $this->filesystem = $filesystem ? $filesystem : new Filesystem(new Local(sys_get_temp_dir()));
    }

    /** * {@inheritdoc} */
    public function optimize($filepath)
    {
        // If the file is on the local filesystem we can optimize it directly         if ($this->mediaService->getAdapterType() === 'local') {
            $this->optimizerService->optimize($filepath);

            

    public function create(array $config)
    {
        if (isset($config['path'])) {
            $config['root'] = $config['path'];
            unset($config['path']);
        }

        $options = $this->resolveOptions($config);

        return new Local(
            $options['root'],
            LOCK_EX,
            Local::DISALLOW_LINKS,
            $options
        );
    }

    /** * @return string */
    public function getType()
    {
Home | Imprint | This part of the site doesn't use cookies.