BoonKiong.com2026™

人气 461

提示上传头像插件

文***已获得官方认证 2023-6-30 15:23

1.png


需要安装JQ库 ➟ JQuery安装,已经安装可以忽略。

1、打开footer模板,在最上面一个</div>的下面添加:

[CSS] 纯文本查看 复制代码
<!--{if ($discuz_uid>0)}-->
        {eval $uid=abs(intval($discuz_uid));}
        {eval $uid=sprintf("%09d", $uid);}
        {eval $dir1=substr($uid,0,3);}
        {eval $dir2=substr($uid,3,2);}
        {eval $dir3=substr($uid,5,2);}
        {eval $avadir=dirname(dirname(dirname(__FILE__)))."/uc_server/data/avatar/".$dir1."/".$dir2."/".$dir3."/".substr($uid,-2)."_avatar_small.jpg";}
        <!--{if (!file_exists($avadir))}-->
                <div id="zy_avatar_cover"></div>
                <div id="zy_avatar_window">
                        <script type="text/javascript" src="{$jspath}calendar.js?{VERHASH}"></script>
                        <script type="text/javascript" src="{$jspath}bbcode.js?{VERHASH}"></script>
                        <script type="text/javascript">
                        var charset = '$charset';
                        var maxsigsize = parseInt('$maxsigsize');
                        var maxbiosize = parseInt('$maxbiosize');
                        var allowhtml = 0;
                        var forumallowhtml = 0;
                        var allowsmilies = 0;
                        var allowbbcode = 0;
                        var allowimgcode = 0;
                        var allowbiobbcode = parseInt('$allowbiobbcode');
                        var allowbioimgcode = parseInt('$allowbioimgcode');
                        var allowsigbbcode = parseInt('$allowsigbbcode');
                        var allowsigimgcode = parseInt('$allowsigimgcode');

                        function parseurl(str, mode) {
                                str = str.replace(/([^>=\]"'\/]|^)((((https?|ftp):\/\/)|www\.)([\w\-]+\.)*[\w\-\u4e00-\u9fa5]+\.([\.a-zA-Z0-9]+|\u4E2D\u56FD|\u7F51\u7EDC|\u516C\u53F8)((\?|\/|:)+[\w\.\/=\?%\-&~`@':+!]*)+\.(jpg|gif|png|bmp))/ig, mode == 'html' ? '$1<img src="$2" border="0">' : '$1[img]$2[/img]');
                                str = str.replace(/([^>=\]"'\/@]|^)((((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k):\/\/)|www\.)([\w\-]+\.)*[:\.@\-\w\u4e00-\u9fa5]+\.([\.a-zA-Z0-9]+|\u4E2D\u56FD|\u7F51\u7EDC|\u516C\u53F8)((\?|\/|:)+[\w\.\/=\?%\-&~`@':+!#]*)*)/ig, mode == 'html' ? '$1<a href="$2" target="_blank">$2</a>' : '$1[url]$2[/url]');
                                str = str.replace(/([^\w>=\]:"'\.\/]|^)(([\-\.\w]+@[\.\-\w]+(\.\w+)+))/ig, mode == 'html' ? '$1<a href="mailto:$2">$2</a>' : '$1[email]$2[/email]');
                                return str;
                        }

                        function validate(theform) {
                                {if $typeid == 2}
                                        {if $maxsigsize}
                                        if(mb_strlen(theform.signaturenew.value) > maxsigsize) {
                                                alert('{lang memcp_profile_sig_toolong}');
                                                return false;
                                        }
                                        {/if}
                                        if(mb_strlen(theform.bionew.value) > maxbiosize) {
                                                alert('{lang memcp_profile_bio_toolong}');
                                                return false;
                                        }
                                        {if !$member[signature]}$('signaturemessage').click();{/if}
                                        {if !$member[bio]}$('biomessage').click();{/if}
                                {/if}
                                return true;
                        }

                        function updateavatar(updatenewbietask) {
                                $('avatar').src='{echo discuz_uc_avatar($discuz_uid, 'middle', TRUE)}{if $avatarmethod}?{else}&{/if}random=1'+Math.random();
                                <!--{if $prompts['newbietask'] && $newbietaskid && $newbietasks[$newbietaskid]['scriptname'] == 'uploadavatar'}-->
                                if(isUndefined(updatenewbietask)) {
                                        ajaxget('task.php?action=updatenewbietask&scriptname=uploadavatar', 'avatarctrl');
                                }
                                <!--{/if}-->
                                if(document.body.stat) document.body.stat('avatar_update_succeed', 'memcp.php');
                                <!--{echo "\$"}-->jq("#zy_avatar_window").hide(300);
                                <!--{echo "\$"}-->jq("#zy_avatar_cover").fadeOut(300,function (){
                                        <!--{echo "\$"}-->jq(this).hide();
                                });
                        }

                        function updatetextarea(id, msg) {
                                $(id).updated = 0;
                                $(id).value = msg;
                                $(id).style.color = '{LIGHTTEXT}';
                                $(id).onclick = function(){
                                        this.style.color = '{TABLETEXT}';
                                        this.value = '';
                                        $(id).onclick = null;
                                }
                        }
                        </script>
<form name="reg" method="post" action="memcp.php?action=profile&amp;typeid=3" onSubmit="return validate(this)" style="zoom:1">
<input type="hidden" name="formhash" value="bfc466bc" />
<h1 class="zy_avatar_h1">你还没有头像!赶快上传一个吧!</h1>
<table summary="修改头像" cellspacing="0" cellpadding="0" class="formtable">
<tr>
<td>
<div class="avatararea">
<p><img id="avatar" src="images/common/none.gif" onerror="this.onerror=null;this.src='http://localhost:1108/dz7.2/uc_server/images/noavatar_middle.gif'" /></p>
</div>
<div class="avatararea" style="display:none;">
                                                                <p><img id="avatar" src="images/common/none.gif" onerror="this.onerror=null;this.src='{UC_API}/images/noavatar_middle.gif'" /></p>
                                                        </div>
{eval require_once DISCUZ_ROOT.'/uc_client/client.php';}
{eval $uc_avatarflash=uc_avatar($discuz_uid, '', 0);}
<div id="avatarctrl"><script type="text/javascript">updateavatar(false);document.write(AC_FL_RunContent('{echo implode("','", $uc_avatarflash);}'));</script></div>
<div><button id="uplater">五分钟后再上传</button></div>
</td>
</tr>
</table>
</form>
</div>
<script>
if (getcookie("zyava_show")!="yes"){
        <!--{echo "\$"}-->jq("#zy_avatar_window").show(500);
        <!--{echo "\$"}-->jq("#zy_avatar_cover").show().fadeTo(500,0.7);
}
        <!--{echo "\$"}-->jq("#zy_avatar_window #uplater").click(function (e){
                e.preventDefault();
                <!--{echo "\$"}-->jq("#zy_avatar_window").hide(300);
                <!--{echo "\$"}-->jq("#zy_avatar_cover").fadeOut(300,function (){
                        <!--{echo "\$"}-->jq(this).hide();
                });
                setcookie("zyava_show","yes",300);
        });
</script>
        <!--{/if}-->
<!--{/if}-->


2、打开css_common模板,在最下面添加:

[CSS] 纯文本查看 复制代码
/*----------章鱼之家上传头像提示---------------*/
#zy_avatar_window .avatararea{float:left;margin:20px;width:120px;}#zy_avatar_window .avatararea a{display:block;margin:15px 0;width:119px;height:31px;line-height:31px;text-align:center;background:url(../../images/default/bigbtn.gif) no-repeat;font-size:14px;}#zy_avatar_window .avatararea a:hover{text-decoration:none;}#zy_avatar_window #avatarctrl{float:left;}#zy_avatar_window .creditstable td{padding:10px 5px !important;}#zy_avatar_window .cre_title{width:50px;}#zy_avatar_window .cre_opt{width:150px;}#zy_avatar_window .cre_arrow{width:30px;}#zy_avatar_window .cre_btn{margin-top:10px;}#zy_avatar_window .zy_avatar_h1{margin:10px;}#zy_avatar_window{position:fixed;left:50%;top:50%;width:650px;height:350px;margin:-185px 0 0 -335px;border:#cacaca 10px solid;background:#ffffff;z-index:501;display:none;}#zy_avatar_cover{position:fixed;left:0;top:0;width:100%;height:100%;z-index:500;background:#000000;opacity:0;filter:alpha(opacity=0);display:none;}




<
您需要登录后才可以回帖 登录 | 立即注册

您还未登录

随手拍~~:

热门推荐~~:

论坛表情分享...

1、洋葱头 ...

Discuz! X3.5 解决小图标不显示的方法...

我发现大多数使用Discuz! X3.5 都有小图标不能显示的问题,提问的时候大家给的回答都是说跨域的问题, ...

如何在 discuz 帖子里添加 APlayer 音乐播...

1、首先将下边的 APlayer.css 和 APlayer.js 代码下载然后解压上传到服务器。 2、单曲音乐的代 ...

Discuz! 相关帖子功能修改随机显示不依赖标...

打开 source/module/forum/forum_viewthread.php 文件,查找: 换行添加: 再查找: 换行添 ...

Discuz! X3.5 手机版 logo 的路径...

打开以下的模板文件,搜索 logo_m.svg 1.template/default/touch/portal/index.htm 2.template/def ...

热度会员~~:

文強berrybkboonkiongadmin老谟深虑TaC9528huaekinteresabitchJCYSORALINc.t.teo

免责声明~~:


本站内容来源于合作伙伴及网络搜集,版权归原作者所有。如有侵犯版权,请立刻和本站联系,我们将在三个工作日内予以改正。
Email:hsbk@hotmail.com

服务与条款|隐私政策|免责声明|手机版|小黑屋|网站地图|友链申请| 文强阁

Powered by Discuz! X3.5|© 2001-2026 Discuz! Team. |本站总访问量已经运行: