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

Time to swap off Cloudinary #644

Open
xdesro opened this issue Jan 1, 2023 · 4 comments · May be fixed by #738
Open

Time to swap off Cloudinary #644

xdesro opened this issue Jan 1, 2023 · 4 comments · May be fixed by #738

Comments

@xdesro
Copy link
Owner

xdesro commented Jan 1, 2023

We've exceeded the free tier of Cloudinary lol. I think something like @11ty/eleventy-img will serve this need better. Not sure how to handle caching and re-requesting screenshots. Right now, if someone updates their site, I can just delete the image on Cloudinary and the app knows to re-screenshot.

@zeroby0
Copy link
Contributor

zeroby0 commented Jan 3, 2023

Heyo!

I'm not an expert on eleventy_img, but I did contribute a bit to it. Please feel free to tag me if you need help with anything related.

Something like a cron job (or maybe github actions or netlify functions?) that takes a screenshot would work quite nicely imo.

The files processed by eleventy_img have a hash in them, calculated from the original file's content (unless the original file is a URL). Because the hash necessarily changes when you change the original screenshot, you can cache them indefinitely in the browser with cache-control: public, max-age=31536000, immutable.

I also wrote a plugin to cache images across builds on netlify: https://github.com/zeroby0/netlify-plugin-11ty/
There's an eleventy screenshot thingy too: https://www.11ty.dev/docs/services/screenshots/

@kirillunlimited
Copy link

kirillunlimited commented Aug 6, 2023

@xdesro
Here is the PR with migration from Cloudinary to 11ty/api-screenshot:
#738

This netlify function should be hosted as a separate project to decouple its cache from https://personalsit.es.
Cache suffix is individual for each website in the list and uses .md file create date. Probably, it should be changed to Last Modified to be able to reset cache for some websites by updating their .md files if necessary.

I made my own project to handle screenshots and deployed it to netlify, but you can fork it and deploy it by yourself if you want.
https://personalsites-screenshots.netlify.app
https://github.com/kirillunlimited/api-screenshot

More info about 11ty/api-screenshot: https://www.zachleat.com/web/screenshots/

@kirillunlimited kirillunlimited linked a pull request Aug 6, 2023 that will close this issue
@woodrunsdeep
Copy link

Hi there!
I've noticed that all images are missing right now. Not sure why though but wanted to let you know.
image

@xdesro
Copy link
Owner Author

xdesro commented Feb 26, 2024

This is exactly the reason, @woodrunsdeep :D. Cloudinary killed my plan and I haven't merged in @kirillunlimited's PR just yet. Thanks for the heads up!

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

Successfully merging a pull request may close this issue.

4 participants