网络营销电子商务研究中心

网络营销电子商务研究中心 (https://www.0058.net/index.php)
-   Discuz/SupeSite/X-Space (https://www.0058.net/forumdisplay.php?f=10)
-   -   分享Discuz X3.2帖子图片全自动添加ALT标签信息的方法 (https://www.0058.net/showthread.php?t=5081)

Radisson 2015-04-17 11:51 AM

分享Discuz X3.2帖子图片全自动添加ALT标签信息的方法
 
找到
/template/default/forum/里面的discuzcode.htm文件,为了方便请大家直接全部代码替换掉吧!
Code:

{eval
function tpl_hide_credits_hidden($creditsrequire) {
global $_G;
}
<!--{block return}--><div class="locked"><!--{if $_G[uid]}-->{$_G[username]}<!--{else}-->{lang guest}<!--{/if}-->{lang post_hide_credits_hidden}</div><!--{/block}-->
<!--{eval return $return;}-->
{eval
}

function tpl_hide_credits($creditsrequire, $message) {
}
<!--{block return}--><div class="locked">{lang post_hide_credits}</div>
$message


<!--{/block}-->
<!--{eval return $return;}-->
{eval
}

function tpl_codedisp($code) {
$randomid = 'code_'.random(3);
}
<!--{block return}--><div class="blockcode"><div id="$randomid"><ol><li>$code</ol></div><em onclick="copycode($('$randomid'));">{lang discuzcode_copyclipboard}</em></div><!--{/block}-->
<!--{eval return $return;}-->
{eval
}

function tpl_quote() {
}
<!--{block return}--><div class="quote"><blockquote>\\1</blockquote></div><!--{/block}-->
<!--{eval return $return;}-->
{eval
}

function tpl_free() {
}
<!--{block return}--><div class="quote"><blockquote>\\1</blockquote></div><!--{/block}-->
<!--{eval return $return;}-->
{eval
}

function tpl_hide_reply() {
global $_G;
}
<!--{block return}--><div class="showhide"><h4>{lang post_hide}</h4>\\1</div>
<!--{/block}-->
<!--{eval return $return;}-->
{eval
}

function tpl_hide_reply_hidden() {
global $_G;
}
<!--{block return}--><div class="locked"><!--{if $_G[uid]}-->{$_G[username]}<!--{else}-->{lang guest}<!--{/if}-->{lang post_hide_reply_hidden}</div><!--{/block}-->
<!--{eval return $return;}-->
{eval
}

function attachlist($attach) {
global $_G;
$attach['refcheck'] = (!$attach['remote'] && $_G['setting']['attachrefcheck']) || ($attach['remote'] && ($_G['setting']['ftp']['hideurl'] || ($attach['isimage'] && $_G['setting']['attachimgpost'] && strtolower(substr($_G['setting']['ftp']['attachurl'], 0, 3)) == 'ftp')));
$aidencode = packaids($attach);
$widthcode = attachwidth($attach['width']);
$is_archive = $_G['forum_thread']['is_archived'] ? "&fid=".$_G['fid']."&archiveid=".$_G[forum_thread][archiveid] : '';
$pluginhook = !empty($_G['setting']['pluginhooks']['viewthread_attach_extra'][$attach[aid]]) ? $_G['setting']['pluginhooks']['viewthread_attach_extra'][$attach[aid]] : '';
}
<!--{block return}-->
<ignore_js_op>
        <dl class="tattl">
                <dt>
                        $attach[attachicon]
                </dt>
                <dd>
                        <p class="attnm">
                                <!--{if !$attach['price'] || $attach['payed']}-->
                                        <a href="forum.php?mod=attachment{$is_archive}&aid=$aidencode" onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})" id="aid$attach[aid]" target="_blank">$attach[filename]</a>
                                <!--{else}-->
                                        <a href="forum.php?mod=misc&action=attachpay&aid=$attach[aid]&tid=$attach[tid]" onclick="showWindow('attachpay', this.href)">$attach[filename]</a>
                                <!--{/if}-->
                                <div class="tip tip_4" id="aid$attach[aid]_menu" style="display: none" disautofocus="true">
                                        <div class="tip_c">
                                                <p class="y">$attach[dateline] {lang upload}</p>
                                                <p>{lang clicktodownload}</p>
                                                <!--{if !$attach['attachimg'] && $_G['getattachcredits']}-->{lang attachcredits}: $_G[getattachcredits]
<!--{/if}-->
                                        </div>
                                        <div class="tip_horn"></div>
                                </div>
                        </p>
                        <p>$attach[attachsize]<!--{if $attach['readperm']}-->, {lang readperm}: <strong>$attach[readperm]</strong><!--{/if}-->, {lang downloads}: $attach[downloads]<!--{if !$attach['attachimg'] && $_G['getattachcredits']}-->, {lang attachcredits}: $_G[getattachcredits]<!--{/if}--></p>
                        <p>
                                <!--{if $attach['price']}-->
                                        {lang price}: <strong>$attach[price] {$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]][unit]}{$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]][title]}</strong>  [<a href="forum.php?mod=misc&action=viewattachpayments&aid=$attach[aid]" onclick="showWindow('attachpay', this.href)" target="_blank">{lang pay_view}</a>]
                                        <!--{if !$attach['payed']}-->
                                                [<a href="forum.php?mod=misc&action=attachpay&aid=$attach[aid]&tid=$attach[tid]" onclick="showWindow('attachpay', this.href)">{lang attachment_buy}</a>]
                                        <!--{/if}-->
                                <!--{/if}-->
                        </p>
                        <!--{if $attach['description']}--><p class="xg2">{$attach[description]}</p><!--{/if}-->
                        $pluginhook
                </dd>
        </dl>
</ignore_js_op>
<!--{/block}-->
<!--{eval return $return;}-->
{eval
}

function imagelist($attach, $firstpost = 0) {
global $_G;
$attach['refcheck'] = (!$attach['remote'] && $_G['setting']['attachrefcheck']) || ($attach['remote'] && ($_G['setting']['ftp']['hideurl'] || ($attach['isimage'] && $_G['setting']['attachimgpost'] && strtolower(substr($_G['setting']['ftp']['attachurl'], 0, 3)) == 'ftp')));
$aidencode = packaids($attach);
$widthcode = attachwidth($attach['width']);
$is_archive = $_G['forum_thread']['is_archived'] ? "&fid=".$_G['fid']."&archiveid=".$_G[forum_thread][archiveid] : '';
$attachthumb = getimgthumbname($attach['attachment']);
$pluginhook = !empty($_G['setting']['pluginhooks']['viewthread_attach_extra'][$attach[aid]]) ? $_G['setting']['pluginhooks']['viewthread_attach_extra'][$attach[aid]] : '';
}
<!--{block return}-->
        <!--{if $attach['attachimg'] && $_G['setting']['showimages'] && ($_G['group']['allowgetimage'] || $_G['uid'] == $attach['uid'])}-->
        <ignore_js_op>
                <!--{if !IS_ROBOT}-->
                        <dl class="tattl attm">
                                <dt></dt>
                                <dd>
                                        <p class="mbn">
                                                <a href="forum.php?mod=attachment{$is_archive}&aid=$aidencode¬humb=yes" onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})" id="aid$attach[aid]" class="xw1" target="_blank">$attach[filename]</a>
                                                <em class="xg1">($attach[attachsize], {lang downloads}: $attach[downloads])</em>
                                                <!--{if $firstpost && $_G['fid'] && $_G['forum']['picstyle'] && ($_G['forum']['ismoderator'] || $_G['uid'] == $attach['uid'])}-->
                                                        <a href="forum.php?mod=ajax&action=setthreadcover&aid=$attach[aid]&fid=$_G[fid]" onclick="showWindow('setcover{$attach[aid]}', this.href)">{lang set_cover}</a>
                                                <!--{/if}-->
                                        </p>
                                        <div class="tip tip_4" id="aid$attach[aid]_menu" style="display: none" disautofocus="true">
                                                <div class="tip_c">
                                                        <p class="y">$attach[dateline] {lang upload}</p>
                                                        <p>{lang clicktodownload}</p>
                                                        <p>
                                                                <a href="javascript:;" onclick="imageRotate('aimg_$attach[aid]', 1)"><img src="{STATICURL}image/common/rleft.gif" class="vm" /></a>
                                                                <a href="javascript:;" onclick="imageRotate('aimg_$attach[aid]', 2)"><img src="{STATICURL}image/common/rright.gif" class="vm" /></a>
                                                        </p>
                                                </div>
                                                <div class="tip_horn"></div>
                                        </div>
                                        <p class="mbn">
                                                <!--{if $attach['readperm']}-->{lang readperm}: <strong>$attach[readperm]</strong><!--{/if}-->
                                                <!--{if $attach['price']}-->{lang price}: <strong>$attach[price] {$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]][unit]}{$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]][title]}</strong>  [<a href="forum.php?mod=misc&action=viewattachpayments&aid=$attach[aid]" onclick="showWindow('attachpay', this.href)" target="_blank">{lang pay_view}</a>]
                                                        <!--{if !$attach['payed']}-->
                                                                [<a href="forum.php?mod=misc&action=attachpay&aid=$attach[aid]&tid=$attach[tid]" onclick="showWindow('attachpay', this.href)" target="_blank">{lang attachment_buy}</a>]
                                                        <!--{/if}-->
                                                <!--{/if}-->
                                        </p>
                                        <!--{if $attach['description']}--><p class="mbn xg2">{$attach[description]}</p><!--{/if}-->
                                        $pluginhook
                                        <!--{if !$attach['price'] || $attach['payed']}-->
                                                <p class="mbn">
                                                <!--{if $_G['setting']['thumbstatus'] && $attach['thumb']}-->
                                                        <a href="javascript:;"><img id="aimg_$attach[aid]" aid="$attach[aid]" src="{STATICURL}image/common/none.gif" onclick="zoom(this, this.getAttribute('zoomfile'), 0, 0, '{$_G[setting][showexif]}')" zoomfile="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬humb=yes{else}{$attach[url]}$attach[attachment]{/if}" file="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode{else}{$attach[url]}$attachthumb{/if}"  alt="$_G[forum_thread][subject] - $_G[setting][sitename] - $attach[imgalt]" title="$_G[forum_thread][subject] - $_G[setting][sitename] - $attach[imgalt]" w="$attach[width]" /></a>
                                                <!--{else}-->
                                                        <img id="aimg_$attach[aid]" aid="$attach[aid]" src="{STATICURL}image/common/none.gif" zoomfile="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬humb=yes{else}{$attach[url]}$attach[attachment]{/if}" file="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes{else}{$attach[url]}$attach[attachment]{/if}" $widthcode  <alt="$_G[forum_thread][subject] - $_G[setting][sitename] - $attach[imgalt]" title="$_G[forum_thread][subject] - $_G[setting][sitename] - $attach[imgalt]" w="$attach[width]" />
                                                <!--{/if}-->
                                                </p>
                                        <!--{/if}-->
                                </dd>
                        </dl>
                <!--{else}-->
                        <dl class="tattl attm">
                        <!--{if !$attach['price'] || $attach['payed']}-->
                                <dd>
                                        <!--{if $attach['description']}--><p>{$attach[description]}</p><!--{/if}-->
                                        <img src="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes{else}{$attach[url]}$attach[attachment]{/if}"  <alt="$_G[forum_thread][subject] - $_G[setting][sitename] - $attach[imgalt]" title="$_G[forum_thread][subject] - $_G[setting][sitename] - $attach[imgalt]" />
                                </dd>
                        <!--{/if}-->
                        </dl>
                <!--{/if}-->
        </ignore_js_op>
        <!--{/if}-->
<!--{/block}-->
<!--{eval return $return;}-->
{eval
}

function attachinpost($attach, $post) {
global $_G;
$firstpost = $post['first'];
$attach['refcheck'] = (!$attach['remote'] && $_G['setting']['attachrefcheck']) || ($attach['remote'] && ($_G['setting']['ftp']['hideurl'] || ($attach['isimage'] && $_G['setting']['attachimgpost'] && strtolower(substr($_G['setting']['ftp']['attachurl'], 0, 3)) == 'ftp')));
$aidencode = packaids($attach);
$widthcode = attachwidth($attach['width']);
$is_archive = $_G['forum_thread']['is_archived'] ? '&fid='.$_G['fid'].'&archiveid='.$_G[forum_thread][archiveid] : '';
$attachthumb = getimgthumbname($attach['attachment']);
$musiccode = getstatus($post[status], 7) && fileext($attach['attachment']) == 'mp3' ? (browserversion('ie') > 8 || browserversion('safari') ? '<audio controls="controls"><source src="'.$attach['url'].$attach['attachment'].'"></audio>' : parseaudio($attach['url'].$attach['attachment'], 400)) : '';
}
<!--{block return}-->
<ignore_js_op>
        <!--{if $attach['attachimg'] && $_G['setting']['showimages'] && (!$attach['price'] || $attach['payed']) && ($_G['group']['allowgetimage'] || $_G['uid'] == $attach['uid'])}-->
                <!--{if !IS_ROBOT}-->
                        <!--{if $_G['setting']['thumbstatus'] && $attach['thumb']}-->
                                <img{if $attach['price'] && $_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']} class="attprice"{/if} style="cursor:pointer" id="aimg_$attach[aid]" aid="$attach[aid]" src="{STATICURL}image/common/none.gif" onclick="zoom(this, this.getAttribute('zoomfile'), 0, 0, '{$_G[setting][showexif]}')" zoomfile="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬humb=yes{else}{$attach[url]}$attach[attachment]{/if}" file="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode{else}{$attach[url]}$attachthumb{/if}" inpost="1"  alt="$_G[forum_thread][subject] - $_G[setting][sitename] - $attach[imgalt]" title="$_G[forum_thread][subject] - $_G[setting][sitename] - $attach[imgalt]" />
                        <!--{else}-->
                                <img{if $attach['price'] && $_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']} class="attprice"{/if} id="aimg_$attach[aid]" aid="$attach[aid]" src="{STATICURL}image/common/none.gif" zoomfile="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬humb=yes{else}{$attach[url]}$attach[attachment]{/if}" file="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes{else}{$attach[url]}$attach[attachment]{/if}" $widthcode id="aimg_$attach[aid]" inpost="1"  <alt="$_G[forum_thread][subject] - $_G[setting][sitename] - $attach[imgalt]" title="$_G[forum_thread][subject] - $_G[setting][sitename] - $attach[imgalt]" />
                        <!--{/if}-->
                        <div class="tip tip_4 aimg_tip" id="aimg_$attach[aid]_menu" style="position: absolute; display: none" disautofocus="true">
                                <div class="tip_c xs0">
                                        <div class="y">$attach[dateline] {lang upload}</div>
                                        <a href="forum.php?mod=attachment{$is_archive}&aid=$aidencode¬humb=yes" title="$attach[filename] {lang downloads}:$attach[downloads]" target="_blank"><strong>{lang download}</strong> <span class="xs0">($attach[attachsize])</span></a>
                                        <!--{if $attach[description]}-->
$attach[description]<!--{/if}-->
                                        <!--{if $firstpost && $_G['fid'] && $_G['forum']['picstyle'] && ($_G['forum']['ismoderator'] || $_G['uid'] == $attach['uid'])}-->
                                               
<a href="forum.php?mod=ajax&action=setthreadcover&aid=$attach[aid]&fid=$_G[fid]" onclick="showWindow('setcover{$attach[aid]}', this.href)">{lang set_cover}</a>
                                        <!--{/if}-->
                <!--{else}-->
                        <!--{if $attach['description']}--><p>{$attach[description]}</p><!--{/if}-->
                        <img src="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes{else}{$attach[url]}$attach[attachment]{/if}" alt="{$_G[forum_thread][short_subject]}" title="{$_G[forum_thread][short_subject]}/>
                        <div style="display: none">
                <!--{/if}-->
        <!--{else}-->
                <!--{if $musiccode}-->
                        <div>$musiccode</div>
                <!--{/if}-->
                $attach[attachicon]
                <span style="white-space: nowrap" id="attach_$attach[aid]" onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})">
                        <!--{if !$attach['price'] || $attach['payed']}-->
                                <a href="forum.php?mod=attachment{$is_archive}&aid=$aidencode" target="_blank">$attach[filename]</a>
                        <!--{else}-->
                                <a href="forum.php?mod=misc&action=attachpay&aid=$attach[aid]&tid=$attach[tid]" onclick="showWindow('attachpay', this.href)">$attach[filename]</a>
                        <!--{/if}-->
                        <em class="xg1">($attach[attachsize], {lang downloads}: $attach[downloads]<!--{if $attach['price']}-->, {lang price}: $attach[price] {$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]][unit]}{$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]][title]}<!--{/if}-->)</em>
                </span>
                <div class="tip tip_4" id="attach_$attach[aid]_menu" style="position: absolute; display: none" disautofocus="true">
                        <div class="tip_c xs0">
                                <div class="y">$attach[dateline] {lang upload}</div>
                                {lang clicktodownload}
                                <!--{if $attach['description']}-->
$attach[description]<!--{/if}-->
                                <!--{if $attach['readperm']}-->
{lang readperm}: $attach[readperm]<!--{/if}-->
        <!--{/if}-->
        <!--{if $attach['price']}-->
               
{lang price}: $attach[price] {$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]][unit]}{$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]][title]}        <a href="forum.php?mod=misc&action=viewattachpayments&aid=$attach[aid]" onclick="showWindow('attachpay', this.href)" target="_blank">[{lang pay_view}]</a>
                <!--{if !$attach['payed']}-->
                        [<a href="forum.php?mod=misc&action=attachpay&aid=$attach[aid]&tid=$attach[tid]" onclick="showWindow('attachpay', this.href)" target="_blank">{lang attachment_buy}</a>]
                <!--{/if}-->
        <!--{/if}-->
        <!--{if !$attach['attachimg'] && $_G['getattachcredits']}-->
{lang attachcredits}: $_G[getattachcredits]<!--{/if}-->
                        </div>
                        <div class="tip_horn"></div>
                </div>
        <!--{if $musiccode}-->
               

        <!--{/if}-->
</ignore_js_op>
<!--{/block}-->
<!--{eval return $return;}-->
<!--{eval
}

}-->



All times are GMT +8. The time now is 04:10 AM.

Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.