Specify a cache validator for images created by imagejpeg/imagepng functions

前端 未结 2 1630
天命终不由人
天命终不由人 2021-02-15 06:53

All we know we can specify a cache validator for images by adding following lines to .htaccess file:


    ExpiresActive On
    Expi         


        
2条回答
  •  北荒
    北荒 (楼主)
    2021-02-15 07:43

    My idea, make change on server configuration, to execute different extension rather then only PHP. for printing images when you use img tag with source of php file to render image. use different extension such as getimage.iphp. Include in your .htaccess settings with cache control of file with extension .iphp

    Finally use header inside your image generation function to set expiry of individual image file.

    Its bit theory but might be useful as idea to implement.

提交回复
热议问题