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

Web proxy usage with Imgix #2

Closed
steverowling opened this issue Nov 25, 2020 · 2 comments
Closed

Web proxy usage with Imgix #2

steverowling opened this issue Nov 25, 2020 · 2 comments

Comments

@steverowling
Copy link

How do I set up the config for this plugin to use Imgix with web proxy sources?

@croxton
Copy link
Owner

croxton commented Nov 26, 2020

With Imgix used as a proxy you need to provide the absolute URL to the image you want to proxy. You can do that at the template level (if you need to proxy multiple domains), or create a source for each proxied domain in your config and pass the proxy domain to the subfolder.

So for example you can have a config like this:

return [
   'my-proxy' => array(
            'domain'   => 'my-proxy-source.imgix.net',
            'subfolder' => 'https://www.my-proxied-website.com/',
            'key'   => 'XXXXXXXXXXXX',
            'defaultParams' => array(
                'auto' => 'compress,format',
                'fit' => 'crop',
                'q' => '80'
            )
        ),
   )
];

And use like this in templates:

{{'uploads/my-image.jpg' | imgix({ source:'my-proxy', ar:'3:2', w:1200, signed: true }) }}

Or a config like this:

return [
   'my-proxy' => array(
            'domain'   => 'my-proxy-source.imgix.net',
            'key'   => 'XXXXXXXXXXXX',
            'defaultParams' => array(
                'auto' => 'compress,format',
                'fit' => 'crop',
                'q' => '80'
            )
        ),
   )
];

And use like this in templates:

{{'https://www.my-proxied-website.com/uploads/my-image.jpg' | imgix({ source:'my-proxy', ar:'3:2', w:1200, signed: true }) }}
{{'https://www.another-proxied-website.com/uploads/another-image.jpg' | imgix({ source:'my-proxy', ar:'3:2', w:1200, signed: true }) }}

@steverowling
Copy link
Author

Ah, by using the subfolder setting! I should have realised. Thanks!

@croxton croxton pinned this issue Jan 5, 2021
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

2 participants