织梦模板简介简介:织梦封面海报图片生成插件,分享给朋友或朋友圈的逼格小插件,减少转发推广域名被封哦。...

第一款 封面图片效果

第一款 实现教程

1、下载下面的所需文件,解压得到poster文件夹,把poster文件夹放进网站根目录的plus文件夹里

如图

2、打开内容页模板 例如 article_article.htm 或者 article_article_m.htm 里面的最下面加入代码,最后生成全站即可

<link rel="stylesheet" href="{dede:global.cfg_cmspath/}/plus/poster/css/poster.css" type="text/css">
<script src="{dede:global.cfg_cmspath/}/plus/poster/js/jquery.min.js" type="text/javascript"></script>
<script src="{dede:global.cfg_cmspath/}/plus/poster/js/html2canvas.min.js" type="text/javascript"></script>
<script src="{dede:global.cfg_cmspath/}/plus/poster/js/common.js" type="text/javascript"></script>
<script type="text/javascript">
	var txt1 = '长按识别二维码查看详情';
	var txt2 = '来自「 织梦官方团队 」';
    var comiis_poster_start_wlat = 0;
	var comiis_rlmenu =  1;
	var comiis_nvscroll =  0;
    var comiis_poster_time_baxt;
    $(document).ready(function(){
        $(document).on('click', '.comiis_poster_a', function(e) {
            show_comiis_poster_ykzn();
        });
    });
    function comiis_poster_rrwz(){
        setTimeout(function(){
            html2canvas(document.querySelector(".comiis_poster_box_img"), {scale:2,useCORS:true}).then(canvas => {
                var img = canvas.toDataURL("image/jpeg", .9);
                document.getElementById('comiis_poster_images').src = img;
                $('.comiis_poster_load').hide();
                $('.comiis_poster_imgshow').show();
            });
        }, 100);
    }
    function show_comiis_poster_ykzn(){
        if(comiis_poster_start_wlat == 0){
            comiis_poster_start_wlat = 1;
            popup.open('<img src="{dede:global.cfg_cmspath/}{dede:global.cfg_cmspath/}/plus/poster/images/imageloading.gif" class="comiis_loading">');
			var url = window.location.href.split('#')[0];
			url = encodeURIComponent(url);
            var html = '<div id="comiis_poster_box" class="comiis_poster_nchxd">
' +
                '<div class="comiis_poster_box">
' +
                '<div class="comiis_poster_okimg">
' +
                '<div style="padding:150px 0;" class="comiis_poster_load">
' +
                '<div class="loading_color">
' +
                '  <span class="loading_color1"></span>
' +
                '  <span class="loading_color2"></span>
' +
                '  <span class="loading_color3"></span>
' +
                '  <span class="loading_color4"></span>
' +
                '  <span class="loading_color5"></span>
' +
                '  <span class="loading_color6"></span>
' +
                '  <span class="loading_color7"></span>
' +
                '</div>
' +
                '<div class="comiis_poster_oktit">正在生成海报, 请稍候</div>
' +
                '</div>
' +
                '<div class="comiis_poster_imgshow" style="display:none">
' +
                '<img src="" class="vm" id="comiis_poster_images">
' +
                '<div class="comiis_poster_oktit">↑长按上图保存图片,分享好友或朋友圈</div>
' +
                '</div>
' +
                '</div>
' +
                '<div class="comiis_poster_okclose"><a href="javascript:;" class="comiis_poster_closekey"><img src="{dede:global.cfg_cmspath/}{dede:global.cfg_cmspath/}/plus/poster/images/poster_okclose.png" class="vm"></a></div>
' +
                '</div>
' +
                '<div class="comiis_poster_box_img zibv cl">
' +
                '<div class="comiis_poster_img"><div class="img_time">{dede:field.pubdate function=MyDate("d",@me)/}<span>{dede:field.pubdate function=MyDate("Y/m",@me)/}</span></div><img src="{dede:field.litpic/}" class="vm" id="comiis_poster_image"></div>
' +
                '<div class="comiis_poster_tita">{dede:field.title/}</div>
' +
                '<div class="comiis_poster_txta">{dede:field.description function=html2text(@me)/} ...</div><div class="comiis_poster_x guig"></div>
' +
                '<div class="comiis_poster_foot fcym">
' +
                '<img src="{dede:global.cfg_cmspath/}{dede:global.cfg_cmspath/}/plus/poster/qrcode.php?url='+url+'" class="kmewm fqpl vm">
' +
                '<img src="{dede:global.cfg_cmspath/}{dede:global.cfg_cmspath/}/plus/poster/images/poster_zw.png" class="kmzw vm"><span class="kmzwtip">'+txt1+'<br>'+txt2+'</span>
' +
                '</div>
' +
                '</div>
' +
                '</div>';
            if(html.indexOf("comiis_poster") >= 0){
                comiis_poster_time_baxt = setTimeout(function(){
                    comiis_poster_rrwz();
                }, 5000);
                $('body').append(html);
                $('#comiis_poster_image').load(function(){
                    clearTimeout(comiis_poster_time_baxt);
                    comiis_poster_rrwz();
                });
                popup.close();
                setTimeout(function() {
                    $('.comiis_poster_box').addClass("comiis_poster_box_show");
                    $('.comiis_poster_closekey').off().on('click', function(e) {
                        $('.comiis_poster_box').removeClass("comiis_poster_box_show").on('webkitTransitionEnd transitionend', function() {
                            $('#comiis_poster_box').remove();
                            comiis_poster_start_wlat = 0;
                        });
                        return false;
                    });
                }, 60);
            }
        }
    }
    var new_comiis_user_share, is_comiis_user_share = 0;
    var as = navigator.appVersion.toLowerCase(), isqws = 0;
    if (as.match(/MicroMessenger/i) == "micromessenger" || as.match(/qq//i) == "qq/") {
        isqws = 1;
    }
    if(isqws == 1){
        if(typeof comiis_user_share === 'function'){
            new_comiis_user_share = comiis_user_share;
            is_comiis_user_share = 1;
        }
        var comiis_user_share = function(){
            if(is_comiis_user_share == 1){
                isusershare = 0;
                new_comiis_user_share();
                if(isusershare == 1){
                    return false;
                }
            }
            isusershare = 1;
            show_comiis_poster_ykzn();
            return false;
        }
    }
</script>
<div class="comiis_footer_scroll">
	<a href="javascript:;" class="comiis_poster_a"><i class="comiis_font"><img src="{dede:global.cfg_cmspath/}/plus/poster/images/ico.png" alt=""></i><span><em>海报</em></span></a>
</div>

3、打开内容页面右下角会多出一个海报按钮



点击海报按钮生成封面海报图片即可


第二款 封面图片效果

第二款 实现教程

1、下载下面的所需文件,解压得到mobileshare文件夹和mobileshare.php文件,把它们放进网站根目录的plus文件夹里

如图

2、打开内容页模板 例如 article_article.htm 或者 article_article_m.htm 在合适的位置加入【生成海报】按钮,最后生成全站即可

<script type="text/javascript">var shareurl = "{dede:global.cfg_cmspath/}/plus/mobileshare.php";</script>
<link href="{dede:global.cfg_cmspath/}/plus/mobileshare/css/mobileshare.css" rel="stylesheet">
<script src="{dede:global.cfg_cmspath/}/plus/mobileshare/js/jquery.min.js"></script>
<script src="{dede:global.cfg_cmspath/}/plus/mobileshare/js/mobileshare.js"></script>
<a class="j-mobile-share" href="javascript:;" data-id="{dede:field.id/}" data-qrcode="{dede:global.cfg_basehost/}{dede:field.id runphp='yes'}$result=GetOneArchive(@me);@me=$result['arcurl'];{/dede:field.id}">生成海报</a>

注意:

class="j-mobile-share" 不能随意更改

data-id 不能随意更改

data-qrcode 不能随意更改

3、打开内容页面查看【生成海报】按钮

点击海报按钮生成封面海报图片即可

版权声明

本文为站长原创文章,未经站长允许不得转载。本文地址:https://www.dedecmsbug.comhttps://www.dedecmsbug.com/plugin/161.html