miltone
miltone

Reputation: 4764

How to change the generated directory and filename of cache file in Symfony Glide

In context of WebApp in Symfony7 & Glide symfony bundle (glide-symfony).

I would like to custom the path of created image cache and also change the generated webp filename in cache.

Lot of config in Glide-symfony but it seems that nothing about those things.

My config glide server :

public function __construct(array $serverConfig)
{
    $this->server = ServerFactory::create(
    [
        'response'                   => new SymfonyResponseFactory(),
        'source'                     => $serverConfig['source_path'],
        'cache'                      => $serverConfig['cache_path'],
        'driver'                     => 'imagick',
        'cache_with_file_extensions' => true,
        'group_cache_in_folders'     => false,
        'base_url'                   => 'toto-on-the-beach',
        'cache_path_prefix'          => 'toto-on-the-sky',
    ]);

    $this->server->setCachePathPrefix(null);
    $this->server->setGroupCacheInFolders(true);
}

With this call :

$server->outputImage('artwork/038099-0.jpg', ['w' => 300, 'h' => 400, 'fm' => 'webp']);

generate this structure folder :

enter image description here

Obviously, I try many things and glide-symfony provide lot of configs but perhaps something lost one me and I don't find the tricks for controlling folder and filename (all the rest ok!).

How can I control generated folder (name, created or no) and generated filename ?

Upvotes: -1

Views: 25

Answers (0)

Related Questions