Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

locale srouce and cache with cdn setting #391

Open
langziyang opened this issue Mar 31, 2024 · 0 comments
Open

locale srouce and cache with cdn setting #391

langziyang opened this issue Mar 31, 2024 · 0 comments

Comments

@langziyang
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant