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.
MIT License
439 stars 52 forks source link

Filenames too long with long urls #160

Closed ibobo closed 3 months ago

ibobo commented 1 year ago

Hi, when remote urls are very long (for example when using Instagram images) the filename gets too long (over 256 chars) and the optimization fails with Error: ENAMETOOLONG: name too long. I suggest using an sha1 of the URL to encode the filename.

Niels-IO commented 1 year ago

Hi @ibobo, Thanks for the suggestion. The problem is that there is no good hashing algorithm available in the client environment. The browser crypto option is only available for https connections. Do you have a suggestion that doesn't blow up the package size?

stx-chris commented 11 months ago

@Niels-IO Have you considered jsSHA? It allows loading individual algorithms to keep the bundle size low.

Niels-IO commented 3 months ago

I used a hash function which I found on Stack Overflow in v1.14.0. This should get rid of the problem with long urls. Could you please confirm?