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

Inlining resized images #84

Open
Juhannuspukki opened this issue Jun 16, 2019 · 2 comments
Open

Inlining resized images #84

Juhannuspukki opened this issue Jun 16, 2019 · 2 comments

Comments

@Juhannuspukki
Copy link

I am currently inlining pretty much all the images on my website since that causes next to prefetch them making navigation appear instantaneous. Still, I figured out it might be a good idea to resize the thumbnail images on my blog in case someone accesses the page directly. It would appear to me that resizing and inlining is not possible, though. I tried stuff like

<img src={require("../static/img/blog/crowd.jpg?inline?resize&size=100")}/>

but no matter what I try, the image is either resized or inlined, but never both. Is what I am trying possible?

@cyrilwanner
Copy link
Owner

Hi @Juhannuspukki
Since we just pass everything to the resize webpack loader when ?resize is in the query param, I think it is correct right now that this doesn't work since the resize webpack loader doesn't support inlining images.

But your use-case makes definitely sense and I'll try to implement this later this week.

@millette
Copy link

millette commented Jun 23, 2019

In my case, I manually resized the image so I could inline it.

Funny story, the image was about 6k, 1500x500. I needed to resize it to 150x50 but when webpack did it, I ended up with a 6k image (with smaller dimensions). Why? My original was using a 2bit palette but the webpack resize set it back to full color. But now that I manually resized it, it's less then 1k.

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

3 participants