Search code examples
phpcachingbase64bandwidth

Encoding images to base64 can help bandwidth usage?


I have a big website that is using too much bandwidth. Because My Webside contains images with High Resolution. Im caching the pages for 6 hours to reduce db usage.

My question here arises.

If i encode the images to base64, and cache that images in my server as base64, can help to reduce my bandwidth usage ?

I'm open to all suggestions coming from you.

Thank you so much.


Solution

  • Seen as base64 won't help, and enabling compression won't help much, you could always use a content delivery network (CDN).

    Chances are you can get a better deal using a CDN than your current service provider, but it really does depend on your current deal.

    Personally, I use Cloudflare. Along with their protection (which I don't really need) they cache certain types of requests, such as images.

    If these images are static you should increase your Expires to years or even decades, but that will only affect returning visitors or caches. Cloudflare should take a significant load off your server. In some circumstances the load (bandwidth) on my server has been reduced by 50% - which is nice.

    Bandwidth saved last month

    Cloudflare has a free tier which I think you might be interested in.

    Test everything thoroughly before using any solution.