I like the trick… but… using Cloudflare might not be the best idea: Why you should avoid Cloudflare's CDN | Usecue web development. Additionally, Hugo can natively resize and crop your images, which might render your trick obsolete. Just set your image directory as your resource dir and you can do things like:
In cases where the site has a lot of images, using the resize function from Cloudflare means you don’t need Hugo to process the files and it gets built faster.
GDPR is all politics. Not being disallowed by GDPR (the lawful limit) or being privacy friendly are two completely different things. Just look at the facts. You have to trust Cloudflare completely for this to be safe. I do not. You are even allowed to use Google Analytics, whereas Google is known to profile your visitors. That does not mean you should.
May I ask what your hosting setup was prior to using Cloudflare? I would only expect an improvement when you would host your website on a machine with very limited RAM or one that is located on the other side of the world. When you spent only 10 euro/month on a VM you can already outperform Cloudflare with ease. I get TTFB’s of about 10 to 15ms.
We are going off topic. If you wish to open another thread and present your arguments why Cloudflare is not compliant to privacy, and in what way they actually make a website slowet, I am more than happy to participate.
I started exploring this a bit tonight, hasn’t come as natural to me not being a particularly great developer and a novice Hugo user.
But I do want to serve the best possible scaled images when I publish things and I was mostly curious in the differences between Hugo’s local image processing engine and something like cloudflare or netlify image offerings with variant/flexible resize and caching.
I weighed the pros and cons for a few weeks while debating what I was going to do next. So I figured I’d give Cloudflare Images a whirl to just see what it is all about.
I do wish they would give you like 100 images to try it out on the free tier.
Hugo gives you more control over your image optimization, but comes at a cost during build time (unless you’re running Hugo in a persistent environment, like a server).
My personal setup: I keep my images in Hugo to make switching to different hosts easier and reduce broken images. When build time gets to be too long, I’m planning to take the lazy route and use CloudFlare Polish + Mirage on their Pro plan.