原文地址:http://www.mengkang.net/blog/post/272.html
看数据库并没用看到用户相关的表中有Avatar相关的字段,所以头像并没用存在数据库中。
根据AvatarModel.class.php发现
1
|
$original_file_name
= '/avatar' .$ this ->convertUidToPath($ this ->_uid). '/original.jpg' ; |
直接根据下面的函数来写死的固定规则的路径保存图片
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
/** *
将用户的UID转换为三级路径 *
@param integer $uid 用户UID *
@return string 用户路径 */ public function convertUidToPath( $uid )
{ //
静态缓存 $sc =
static_cache( 'avatar_uidpath_' . $uid ); if (! empty ( $sc ))
{ return $sc ; } $md5 =
md5( $uid ); $sc = '/' . substr ( $md5 ,
0, 2). '/' . substr ( $md5 ,
2, 2). '/' . substr ( $md5 ,
4, 2); static_cache( 'avatar_uidpath_' . $uid , $sc ); return $sc ; }
|