Cache PHP re-sized images using Litespeed cache?


Well-Known Member
One of my website usually resize images on the fly based on user screen resolution. I am thinking about at one tweak. I wish to cache those particular resized images using litespeed. Is that possible to cache only images. My http header response for a resized files looks as follows.
HTTP/1.1 200 OK =>
Date => Wed, 18 Jul 2018 19:30:00 GMT
Content-Type => binary/data
Content-Length => 261741
Connection => close
Set-Cookie => __cfduid=d11a114350e1e09215d6fd2e7b2bc2f781531942200; expires=Thu, 18-Jul-19 19:30:00 GMT; path=/;; HttpOnly; Secure
Content-Disposition => attachment; filename=cara-delevingne-1728x1080-2018-4k-14700.jpg
Last-Modified => Wed, 18 Jul 2018 19:30:01 GMT
X-Turbo-Charged-By => LiteSpeed
CF-Cache-Status => MISS
Expires => Sat, 18 Aug 2018 19:30:00 GMT
Cache-Control => public, max-age=2678400
Accept-Ranges => bytes
Expect-CT => max-age=604800, report-uri=""
Server => cloudflare
CF-RAY => 43c75c3effbc719d-ORD
In the above user has requested for 1728x1080 resolution, and image resized from original to requested resolution on the fly without storing that resized file. I want to cache those resized images to be able to serve for another user using Litespeed cache.

Is it possible? Nevermind about file size and storage.


Well-Known Member
Staff member
LiteSpeed cache doesn't cache static files, like image files etc. for your case, you might need to keep a few selected common resized images to make it retrieving faster next time. Everytime resizing the image on the fly will definitely slow down your site performance.