Webwide is the inclusive forum community for web designers, developers & makers.

Whether you're an enthusiast, in training, or a seasoned pro – you'll fit right in at Webwide. We understand that our community is one of creation which is why we, unlike many other discussion forums, encourage sharing of your own projects and content. Creating a forum account is fast, easy and completely free so you can start participating right away.

Read our Code of Conduct

Free Forum Membership Benefits

  • Participate in hundreds of interesting discussions
  • Network with industry peers and make new connections
  • Show off your own projects and relevant content
  • Get help and feedback for your coding and designs
  • Buy and sell services and resources in the marketplace
  • Participate in our friendly community challenges
  • Earn trophies and work your way up our leaderboards
  • Enjoy exclusive Webwide member discounts and offers
  • ...and so much more!

Resource How I've made my own image manipulation CDN for 3€/month

Gummibeer

Well-known member
Joined
Oct 5, 2019
Messages
799
Reaction score
674
Points
785
Age
27
Location
Hamburg, Germany
Local Time
Today, 12:17
Website
gummibeer.de
Hey all,

because of a downtime of Image cache & resize service today I've checked alternatives (except paying thousands of dollars for Cloudinary, Imgix ...).
After some research I've found h2non/imaginary which does everything I want.

So I've booted a 3€/month VPS on Truly thrifty cloud hosting - Hetzner Online GmbH and installed it - result: works like a charm.

So I started playing around, added a list of allowed URLs, configured Cloudflare CDN via page rules and now I have a blazing fast image manipulation CDN which has a whitelist of domains, uses signed URLs to prevent user manipulation and the worlds best (free) CDN infront of it - which also adds SSL without any letsencrypt or whatever.

Conclusion:
Hetzner Cloud is super easy to setup, the servers are pretty fast and the price is unbeatable.
Imaginary has a not perfect HTTP API, but I will build a PHP fluent URL builder like my Astrotomic/php-weserv-images before. Except of this the library is outstanding. The support of URL retrieving and all the security features are perfect to setup a public image CDN service limited to a set of domains.

The major benefit for me: I have a single service which will handle all my pages and every page can use it's own CDN url. All my pages are on Cloudflare already - so I only have to add an A-record and a page rule:
Code:
https://imaginary.example.com/*
SSL: Flexible
Browser Cache TTL: a month
Cache Level: Cache Everything
Edge Cache TTL: a month
And because Cloudflare does all the CDN and caching stuff I don't have to care about it - don't have to provide/pay for any storage to cache.
 
  • Wow
Reactions: Adam

Gummibeer

Well-known member
Joined
Oct 5, 2019
Messages
799
Reaction score
674
Points
785
Age
27
Location
Hamburg, Germany
Local Time
Today, 12:17
Website
gummibeer.de
And after I've told it @tom he destroyed my dream and gifted me an unicorn:


Is there anything Cloudflare doesn't offer?^^

Okay - it only applies to business and enterprise, so 200$+

Image Resizing is available today for Business and Enterprise Customers.
 
Last edited:
  • Haha
Reactions: Adam

Gummibeer

Well-known member
Joined
Oct 5, 2019
Messages
799
Reaction score
674
Points
785
Age
27
Location
Hamburg, Germany
Local Time
Today, 12:17
Website
gummibeer.de
This is awesome! Could use something like this to open up image uploads to all on here.
Don't get me wrong: you still need anywhere to store the images. But this one could be the slowest VM in the world, but this setup allows you to resize them on the fly and have the resizes cached in a CDN.
So if storage is the problem: this isn't the solution. If only traffic is the problem: here you go! 😉

Imaginary can also load from a local directory. So if you find a cheap server with lots of storage you can use relative paths instead of full URLs.
 

Mike Rees

Member
Joined
Feb 3, 2020
Messages
26
Reaction score
48
Points
20
Location
Leicester, UK
Local Time
Today, 11:17
Depending on the traffic you're expecting, this AWS Serverless solution might work out cheaper. Of course you lose the added benefits you mention, but I thought I'd chip in with this one as it's proven invaluable to me in the past.
 

Gummibeer

Well-known member
Joined
Oct 5, 2019
Messages
799
Reaction score
674
Points
785
Age
27
Location
Hamburg, Germany
Local Time
Today, 12:17
Website
gummibeer.de
Depending on the traffic you're expecting, this AWS Serverless solution might work out cheaper. Of course you lose the added benefits you mention, but I thought I'd chip in with this one as it's proven invaluable to me in the past.
My problem with all serverless solutions is that I have to handle really large images (100-150MB PNGs). All FaaS I've found limit file inputs with 100MB or the RAM isn't enough.

And I like the 3€ fixed over a flexible pricing.
But I agree that for most simple web images cases FaaS would be a good solution.

And at least for me AWS isn't as easy to setup as a simple VM.
 
Last edited:
Top