コード例 #1
0
ファイル: Pic.php プロジェクト: jiangsuei8/public_php_shl
 /**
  * 获取图片路径
  * 
  * @param	int		$index	图片标示(调用者必须先判断该参数合法, 比如为用户图片的话,要先判断$index是否为合法QQ号)
  * @param	string	$type	图片类型
  * 
  * @return	string	若用户QQ号不正确, 返回空字符串, 否则返回图片路径
  */
 public static function getPhotoPath($index, $type)
 {
     self::clearERR();
     if (!in_array($type, self::$typeArr)) {
         self::$errCode = 10621;
         self::$errMsg = "input type-{$type} is illegal.";
         return false;
     }
     $mdstr = md5($index);
     $lvl1 = substr($mdstr, 0, 2);
     $lvl2 = substr($mdstr, -2);
     $oitstr = oi_symmetry_encrypt2($index, 'QzoneCommunity' . $type, true);
     $path = $type . '/' . $lvl1 . '/' . $lvl2 . '/' . $oitstr . '.jpg';
     return $path;
 }