function uc_avatar($uid) { $uid = intval($uid); $uc_input = uc_api_input("uid={$uid}"); $uc_avatarflash = UC_API . '/images/camera.swf?inajax=1&appid=' . UC_APPID . '&input=' . $uc_input . '&agent=' . md5($_SERVER['HTTP_USER_AGENT']) . '&ucapi=' . urlencode(UC_API); return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9" width=447 height=477 id="mycamera"><param name="movie" value="' . $uc_avatarflash . '"><param name="quality" value="high"><param name="menu" value="false"><embed src="' . $uc_avatarflash . '" quality="high" menu="false" width="447" height="477" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" name="mycamera" swLiveConnect="true"></embed></object>'; }
function uc_avatar($uid, $type = 'virtual', $returnhtml = 1) { $uid = intval($uid); $uc_input = uc_api_input("uid={$uid}"); $uc_avatarflash = UC_API . '/images/camera.swf?inajax=1&appid=' . UC_APPID . '&input=' . $uc_input . '&agent=' . md5($_SERVER['HTTP_USER_AGENT']) . '&ucapi=' . urlencode(str_replace('http://', '', UC_API)) . '&avatartype=' . $type . '&uploadSize=2048'; if ($returnhtml) { return '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="450" height="253" id="mycamera" align="middle"> <param name="allowScriptAccess" value="always" /> <param name="scale" value="exactfit" /> <param name="wmode" value="transparent" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="movie" value="' . $uc_avatarflash . '" /> <param name="menu" value="false" /> <embed src="' . $uc_avatarflash . '" quality="high" bgcolor="#ffffff" width="450" height="253" name="mycamera" align="middle" allowScriptAccess="always" allowFullScreen="false" scale="exactfit" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object>'; } else { return array('width', '450', 'height', '253', 'scale', 'exactfit', 'src', $uc_avatarflash, 'id', 'mycamera', 'name', 'mycamera', 'quality', 'high', 'bgcolor', '#ffffff', 'menu', 'false', 'swLiveConnect', 'true', 'allowScriptAccess', 'always'); } }
/** * 修改头像 * * @param int $uid 用户ID * @param string $type 头像类型 real OR virtual 默认为 virtual * @return string */ function capi_uc_avatar($uid, $type = 'virtual', $returnurl = 0) { $uid = intval($uid); $uc_input = uc_api_input("uid={$uid}"); if ($returnurl) { $uc_avatar = UC_API . '/index.php?a=uploadavatar4m&m=user&inajax=1&appid=' . UC_APPID . '&input=' . $uc_input . '&agent=' . md5($_SERVER['HTTP_USER_AGENT']) . '&avatartype=' . $type; return $uc_avatar; } return array('UC_API' => UC_API, 'appid' => UC_APPID, 'input' => $uc_input, 'agent' => md5($_SERVER['HTTP_USER_AGENT']), 'ucapi' => urlencode(UC_API), 'avatartype' => $type); }