File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ Most of them are editable on Symphony's Preferences page.
2727 'disable_upscaling' => 'yes', // yes/no (editable)
2828 'disable_proxy_transform' => 'yes', // yes/no (editable)
2929 'allow_origin' => '', // string (editable)
30+ 'max_age' => null, // integer (hidden)
3031),
3132```
3233
@@ -54,6 +55,10 @@ Setting this to 'yes' will add a HTTP header to the response telling proxies to
5455
5556If not empty, this value will be sent as the Cross-Origin HTTP header
5657
58+ ### max_age
59+
60+ The value, in seconds, for the max-age specifier in the Cache-Control HTTP Header
61+
5762## Updating
5863
5964### 2.0.0
Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ public function update($previousVersion = false)
173173 }
174174 }
175175
176- if (version_compare ($ previousVersion , '2.0.0 ' , '< ' )) {
176+ if (version_compare ($ previousVersion , '2.0.1 ' , '< ' )) {
177177 try {
178178 // Re-simplify JIT htaccess rule
179179 // see c7cd6183ffd15b9a8b7864df2eb29d3c1d96b5f9
@@ -191,6 +191,25 @@ public function update($previousVersion = false)
191191 throw new Exception ($ message );
192192 }
193193 }
194+
195+ if (version_compare ($ previousVersion , '2.0.2 ' , '< ' )) {
196+ try {
197+ $ maxage = Symphony::Configuration ()->get ('max-age ' , 'image ' );
198+ if (!empty ($ maxage )) {
199+ Symphony::Configuration ()->set ('max_age ' , $ maxage , 'image ' );
200+ }
201+ Symphony::Configuration ()->remove ('max-age ' , 'image ' );
202+ } catch (Exception $ ex ) {
203+ $ message = __ (
204+ 'An error occured while updating %s. %s ' ,
205+ array (
206+ __ ('JIT Image Manipulation ' ),
207+ $ ex ->getMessage ()
208+ )
209+ );
210+ throw new Exception ($ message );
211+ }
212+ }
194213 }
195214
196215 public function uninstall ()
Original file line number Diff line number Diff line change 1616 </author >
1717 </authors >
1818 <releases >
19- <release version =" 2.0.1 " date =" TBA" min =" 2.6.0" max =" 2.x.x" >
19+ <release version =" 2.0.2 " date =" TBA" min =" 2.6.0" max =" 2.x.x" >
2020 - Refactored all filters to eliminate duplicated code
2121 - Fixed a couple of bugs (#120, #121, #106)
2222 - Fixed a regression in the .htaccess rule, where the file extension was added to the RewriteRule.
Original file line number Diff line number Diff line change @@ -333,8 +333,12 @@ public function sendImageHeaders($parameters)
333333 $ cacheControl .= ', no-transform ' ;
334334 }
335335
336- // Add max-age directive at the end
337- $ cacheControl .= '; max-age=31536000 ' ;
336+ // Use configured max-age or fallback on 3 days (See #88)
337+ $ maxage = isset ($ this ->settings ['max_age ' ]) ? $ this ->settings ['max_age ' ] : 86400 ;
338+ if (!empty ($ maxage )) {
339+ // Add max-age directive at the end
340+ $ cacheControl .= '; max-age= ' . $ maxage ;
341+ }
338342
339343 header ('Last-Modified: ' . $ last_modified_gmt );
340344 header (sprintf ('ETag: "%s" ' , $ etag ));
You can’t perform that action at this time.
0 commit comments