Skip to content

Added support custom domains for images#208

Open
mihailShumilov wants to merge 4 commits into
Niels-IO:masterfrom
mihailShumilov:master
Open

Added support custom domains for images#208
mihailShumilov wants to merge 4 commits into
Niels-IO:masterfrom
mihailShumilov:master

Conversation

@mihailShumilov

Copy link
Copy Markdown

added support for custom domain for images
to use custom domain you should set config param nextImageExportOptimizer_imagesDomain

to use custom domain you should set config param `nextImageExportOptimizer_imagesDomain`
@mihailShumilov

Copy link
Copy Markdown
Author

@Niels-IO - 1 month without any review...

@Niels-IO

Niels-IO commented Apr 7, 2024

Copy link
Copy Markdown
Owner

Hi @mihailShumilov,
Thanks for the PR. As this is not my main work, things might take their time.. I will have a look but it might take until May.

@mihailShumilov

Copy link
Copy Markdown
Author

Hi @mihailShumilov, Thanks for the PR. As this is not my main work, things might take their time.. I will have a look but it might take until May.

If you want - you can add me as a maintainer/collaborator - I can help you with this project

@dannyDNS

dannyDNS commented Jun 12, 2024

Copy link
Copy Markdown

I was just looking at implementing support for this myself. Have you considered reading the assetPrefix value from the next config?

Edit: the actual problem here IMO is that this package doesn't respect assetPrefix, making it incompatible with other methods of rendering images on the page (i.e. as a background image). If you're using assetPrefix, this package mangles your URLs, making srcSets that are broken.

@Niels-IO

Copy link
Copy Markdown
Owner

Hi there,

Can you please explain the use case for using custom domains? Regarding assetPrefix: The Next.js documentation specifies:

While assetPrefix covers requests to _next/static, it does not influence the following paths:

Files in the public folder; if you want to serve those assets over a CDN, you'll have to introduce the prefix yourself

So I think this would add the need to handle statically imported images and string paths differently if I were to implement assetPrefix. Also assetPrefix would be a global setting for all assets.

This PR is also mixing two added functionalities: custom image domains and some very user specific custom logic for mobile src's. The mobile src conditional should live in user land not inside this package.

@PhilGale92

Copy link
Copy Markdown

Just thought I'd add to this - i have a very similar use case to the above - i had a requirement of having the images served with the assetPrefix which is not an actual folder but rather from akmai routing.

Not piling in or anything but its not just a single edge case.

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

Successfully merging this pull request may close these issues.

4 participants