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

Image shortcode error with “jpg” file extensions #8

Open
tedw opened this issue Feb 17, 2021 · 1 comment
Open

Image shortcode error with “jpg” file extensions #8

tedw opened this issue Feb 17, 2021 · 1 comment

Comments

@tedw
Copy link

tedw commented Feb 17, 2021

FYI, after updating @11ty/eleventy-img to 0.8.0 I was getting this error:

TypeError: Cannot read property 'reverse' of undefined

const fallback = stats[extension].reverse()[0];

After reading through the changes, it turned out to be related to this fix 11ty/eleventy-img#64 (comment).

Regardless of whether the source image uses the jpg or jpeg extension, the returned object will use the jpeg key.

Here’s how I fixed it in my project:

let extension = path.extname(src).slice(1).toLowerCase();

// Normalize “jpg” extension to match what @11ty/eleventy-img does
extension = extension == 'jpg' ? 'jpeg' : extension;
@clenemt
Copy link
Owner

clenemt commented Feb 21, 2021

Thanks, will have a look !

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