为了接入cdn,需要头像调用链接带版本号,在新上传头像后能立即生效。
diff --git a/tmp/function_core.php b/function_core.php
index 06910f1..3046715 100644
--- a/tmp/function_core.php
+++ b/function_core.php
@@ -416,7 +416,9 @@ function avatar($uid, $size = 'middle', $returnsrc = FALSE, $real = FALSE, $stat
$dir1 = substr($uid, 0, 3);
$dir2 = substr($uid, 3, 2);
$dir3 = substr($uid, 5, 2);
- $file = $ucenterurl.'/data/avatar/'.$dir1.'/'.$dir2.'/'.$dir3.'/'.substr($uid, -2).($real ? '_real' : '').'_avatar_'.$size.'.jpg';
+ $file = '/data/avatar/'.$dir1.'/'.$dir2.'/'.$dir3.'/'.substr($uid, -2).($real ? '_real' : '').'_avatar_'.$size.'.jpg';
+ $ts = filemtime(DISCUZ_ROOT . "uc_server" . $file);
+ $file = $ucenterurl.$file."?ts=".$ts;
return $returnsrc ? $file : '<img src="'.$file.'" onerror="this.onerror=null;this.src=\''.$ucenterurl.'/images/noavatar_'.$size.'.gif\'" />';
}
}
|