Image Caching in Phalcon

Does phalcon supports Image caching if yes please share some example??



60.8k

please dont be mad at me :D cloudflare . com

edited Aug '16

OMG Report @Izo for advertising!!!! :)



60.8k

hahah :D. its free tho :P

Automatic static content caching is included in the free plan. I use it for myself.



60.8k
edited Aug '16

btw muhammadahsan1991 what is the idea of the question ? It doesnt make much of a sence, serving images from the webserver doesnt have much to do with phalcon or any other framwork or application.

Do you mean like you resize your images on the fly and thats why you need caching ? If so take a look at this lib here https://github.com/Intervention/imagecache

I usually do it when I upload image i resize it like this:

images/products/ ID / image name.png
images/products/ ID / thumbs450/image name.png
images/products/ ID / thumbs/image name.png

and each image is saved 3 times, the main image i also resize and reduce the quality to 1280 x 1024, main pic is usually around 60 kb.

Let us know what the idea is

edited Aug '16

@Izo there is an extra . at the end of your Github link, which is breaking it.



60.8k

auto correct :D :D :D

My situation is that my website include images from another server which increases the load time and to decrease the load time I want to cache images on my server so that it quickly loads through it

btw muhammadahsan1991 what is the idea of the question ? It doesnt make much of a sence, serving images from the webserver doesnt have much to do with phalcon or any other framwork or application.

Do you mean like you resize your images on the fly and thats why you need caching ? If so take a look at this lib here https://github.com/Intervention/imagecache

I usually do it when I upload image i resize it like this:

``` images/products/ ID / image name.png images/products/ ID / thumbs450/image name.png images/products/ ID / thumbs/image name.png ```

and each image is saved 3 times, the main image i also resize and reduce the quality to 1280 x 1024, main pic is usually around 60 kb.

Let us know what the idea is



60.8k

do curls to donwload the images in an interval and serve them yourself.

https://github.com/phalcon/website/blob/master/app/controllers/ControllerBase.php#L10

edited Aug '16

If you depend on dynamic remote content, I'm afraid there's not a simple solution. The thing is, if yoy try to preload those images on your own, it would raise the same performance hit.

Only if those images are static, i.e. they really don't change on a daily basis, you can run nightly cron task to fetch all remote resources and then to serve them on your (hopefully) supercharged nginx web server alongside Phalcon.

Or simply ask remote site to put their static content onto CDN.