Niels-IO / next-image-export-optimizer

Use Next.js advanced <Image/> component with the static export functionality. Optimizes all static images in an additional step after the Next.js static export.
413 stars 51 forks source link

Adding custom options when fetching remote images #213

Open mmarseu opened 3 months ago

mmarseu commented 3 months ago

Could you add a way to add custom option to the HTTP requests made when downloading remote images?

I have some images hosted on internal servers. To fetch these, custom headers must be set. As far as I can tell, there is no way to provide these headers - apart from monkeypatching shenanigans.

I figure the most versatile implementation would be to enable remoteOptimizedImages.js to return these options with each URL, since they might not be the same for all remote images.

Niels-IO commented 2 months ago

Hi @mmarseu,

Let me think about this. In general, the remote image feature needs more work and I will have a look how this could be implemented.

Niels-IO commented 3 weeks ago

I just enabled the functionality of query params in remote images. Would that be enough for your use case?

mmarseu commented 3 weeks ago

It's always great to see progress but unfortunately no. In my case, I really need to set custom headers for the image request.

Niels-IO commented 3 weeks ago

Hi @mmarseu,

I created a PR with a proposal for this functionality: #223

If you have time, you could check it out and give your feedback.

Thanks, Niels