aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM. Dent <dentm42@gmail.com>2019-10-14 22:28:48 +0200
committerMax Kostikov <max@kostikov.co>2019-10-14 22:28:48 +0200
commit7d0e576e3b480e6f4220e1290ff50153ed26be1a (patch)
tree5bda81040caa2492c55454b41ed11c1aad1bafc4
parentaa330bc8c77946b076a6365f7f5c5e34a37d5997 (diff)
downloadvolse-hubzilla-7d0e576e3b480e6f4220e1290ff50153ed26be1a.tar.gz
volse-hubzilla-7d0e576e3b480e6f4220e1290ff50153ed26be1a.tar.bz2
volse-hubzilla-7d0e576e3b480e6f4220e1290ff50153ed26be1a.zip
Updates to zcard/profile images and other public images to account for infrastructure caches (CDN)
-rw-r--r--Zotlabs/Module/Photo.php8
-rw-r--r--include/channel.php6
-rw-r--r--include/nav.php2
3 files changed, 11 insertions, 5 deletions
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php
index 59dc709e1..162d62815 100644
--- a/Zotlabs/Module/Photo.php
+++ b/Zotlabs/Module/Photo.php
@@ -272,7 +272,13 @@ class Photo extends \Zotlabs\Web\Controller {
$maxage = $expires - time();
header("Expires: " . gmdate("D, d M Y H:i:s", $expires) . " GMT");
- header("Cache-Control: max-age=" . $maxage . $cachecontrol);
+
+ // set CDN/Infrastructure caching much lower than maxage
+ // in the event that infrastructure caching is present.
+ $smaxage = intval($maxage/12);
+
+
+ header("Cache-Control: s-maxage=' .$smaxage. '; max-age=" . $maxage . $cachecontrol);
}
diff --git a/include/channel.php b/include/channel.php
index 5d583e4f1..29835eac6 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -2254,19 +2254,19 @@ function get_zcard($channel, $observer_hash = '', $args = array()) {
$cover_width = 425;
$size = 'hz_small';
$cover_size = PHOTO_RES_COVER_425;
- $pphoto = array('mimetype' => $channel['xchan_photo_mimetype'], 'width' => 80 , 'height' => 80, 'href' => $channel['xchan_photo_m']);
+ $pphoto = array('mimetype' => $channel['xchan_photo_mimetype'], 'width' => 80 , 'height' => 80, 'href' => $channel['xchan_photo_m'].'?rev='.strtotime($channel['xchan_photo_date']));
} elseif($maxwidth <= 900) {
$width = 900;
$cover_width = 850;
$size = 'hz_medium';
$cover_size = PHOTO_RES_COVER_850;
- $pphoto = array('mimetype' => $channel['xchan_photo_mimetype'], 'width' => 160 , 'height' => 160, 'href' => $channel['xchan_photo_l']);
+ $pphoto = array('mimetype' => $channel['xchan_photo_mimetype'], 'width' => 160 , 'height' => 160, 'href' => $channel['xchan_photo_l'].'?rev='.strtotime($channel['xchan_photo_date']));
} elseif($maxwidth <= 1200) {
$width = 1200;
$cover_width = 1200;
$size = 'hz_large';
$cover_size = PHOTO_RES_COVER_1200;
- $pphoto = array('mimetype' => $channel['xchan_photo_mimetype'], 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']);
+ $pphoto = array('mimetype' => $channel['xchan_photo_mimetype'], 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l'].'?rev='.strtotime($channel['xchan_photo_date']));
}
// $scale = (float) $maxwidth / $width;
diff --git a/include/nav.php b/include/nav.php
index 3e1acd306..672cc2689 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -80,7 +80,7 @@ function nav($template = 'default') {
if($observer) {
$userinfo = [
- 'icon' => $observer['xchan_photo_m'],
+ 'icon' => $observer['xchan_photo_m'].'?rev='.strtotime($observer['xchan_photo_date']),
'name' => $observer['xchan_addr'],
];
}