Best way to cache resized images using PHP and MySQL

前端 未结 9 1558
庸人自扰
庸人自扰 2020-12-22 23:54

What would be the best practice way to handle the caching of images using PHP.

The filename is currently stored in a MySQL database which is renamed to a GUID on upl

9条回答
  •  眼角桃花
    2020-12-23 00:34

    That sounds like a solid way to do it. The next step may be to go beyond PHP/MySQL.

    Perhaps, tweak your headers:

    If you're using PHP to send MIME types, you might also use 'Keep-alive' and 'Cache-control' headers to extend the life of your images on the server and take some of the load off of PHP/MySQL.

    Also, consider apache plugin(s) for caching as well. Like mod_expires.

    Oh, one more thing, how much control do you have over your server? Should we limit this conversation to just PHP/MySQL?

提交回复
热议问题