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

Resize images on upload/on render #23

Open
jacobobryant opened this issue Jun 18, 2022 · 0 comments
Open

Resize images on upload/on render #23

jacobobryant opened this issue Jun 18, 2022 · 0 comments

Comments

@jacobobryant
Copy link
Owner

It'd be nice if we could handle image resizing in one way or another. #17 talks about resizing the image element in the DOM but doesn't cover resizing the original file. (Same for the default theme code; images are displayed at the right size, but the files will sometimes be bigger than they need to be.)

One option: have theme code use https://images.weserv.nl/, a free image resize/editing service. It's very convenient; you pass in a url to the original file along with some size params etc and they'll resize, cache, and serve the image for you on demand.

Another option: upload-image could put the original + a few standard sizes on s3, and then we update the data model in one way or another to include all the sizes. Perhaps add keys like :image/url-small, :image/url-medium etc. Then in different contexts we use different urls. Maybe when you're uploading an image from the TinyMCE, we use a medium/large size ("large" might still be smaller than the original size), and when you're uploading an image in the post sidebar (i.e. for use in social media previews) then we use a smaller size. Or have theme code figure out which size to use somehow.

I like the first option, but one downside is you can't use it for the post metadata because images.weserv.nl's robots.txt file. otoh often for preview images they're custom made in the correct size to begin with so maybe not a big deal; just use the original url for that and use images.weserv.nl for images in post content etc. 🤷‍♂️

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

1 participant