Skip to content

locale srouce and cache with cdn setting #391

Open
@langziyang

Description

source file and cache is on locale. but i have setting amazon CloudFront.

when direct request 'https://xxxx.cloudfront.net/product/1/Soft-Axami_1_6607c41abda77.jpg' it work.

but i want use glide so i created router like this:

#[Route('/image/read', name: 'image.read')]
    public function readImage(Request $request, ConfigurationService $configurationService)
    {
        try {
            $domain=$configurationService->getSetting('SYSTEM_IMAGE_DOMAIN',true);
            if(!$domain){
                $request->getSchemeAndHttpHost();
            }
            $path = $request->query->get('path');

            $source_dir = $this->getParameter('kernel.project_dir') . '/public';
            $server = ServerFactory::create([
                'source' => new Filesystem(new LocalFilesystemAdapter($source_dir)),
                'response' => new SymfonyResponseFactory(),
                'cache' => $source_dir . '/cache',
                'driver' => 'imagick',
            ]);
            $query = $request->query->all();
            unset($query['path']);
            return $server->getImageResponse($path, $query);
        } catch (\Exception $e) {
            return new RedirectResponse('');
        }
    }

i want kown how can i use amazon CloudFront return cache file

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions