Best way to cache resized images using PHP and MySQL

前端 未结 9 1554
庸人自扰
庸人自扰 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:47

    Your approach seems quite reasonable - I would add that some mechanism should be put into place to check that the date the cached version was generated was after the last modified timestamp of the original (source) image file and if not regenerate the cached/resized version. This will ensure that if an image is changed by the designers the cache will be updated appropriately.

提交回复
热议问题