如何解决 gif 共享 facebook 的问题 sharer.php

How to fix problem with gif sharing facebook sharer.php

我有一个关于 facebook 分享器的问题,当分享它时,生成文件路径并在 facebook 上分享原生 gif 准备显示在用户的时间线上。 我当然在用

.qa_html ($ this-> content ['description']).

这是最终 .gif 文件的目的地

.qa_html ($ shareurl). 是出版物的 url 是我希望用户在单击左下角和 facebook 上的网站按钮时被重定向到的那个下图。



有人能告诉我如何通过在用户时间轴上显示本机 gif 来更改继续到 facebook 的共享,但使用基于此信息的发布地址吗?


我的元变量

$this->output('<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />');
        $this->head_links();
        if ($this->template == 'question' && strpos(qa_get_state(), 'edit')===false ) {
                $pagetitle=strlen($this->request) ? strip_tags($this->content['title']) : '';
                $headtitle=(strlen($pagetitle) ? ($pagetitle.'') : '');

                $this->output('<meta property="og:url" content="'.qa_html( $this->content['canonical'] ).'" />');
                $this->output('<meta property="og:type" content="article" />');
                $this->output('<meta property="og:title" content="'.qa_html( $headtitle ).'" />');
                $this->output('<meta property="og:description" content="Click To Watch" />');
                $this->output('<meta property="og:image" content="'.qa_html( $this->content['description'] ).'"/>');
                $this->output('<meta name="twitter:card" content="summary_large_image">');
                $this->output('<meta name="twitter:title" content="'.qa_html( $headtitle ).'">');
                $this->output('<meta name="twitter:description" content="'.qa_html( $headtitle ).'">');
                $this->output('<meta name="twitter:image" content="'.qa_html( $this->content['description'] ).'">');
                $this->output('<meta itemprop="description" content="click to watch">');
                $this->output('<meta itemprop="image" content="'.qa_html( $this->content['description'] ).'">');
                $this->output('<link rel="image_src" type="image/jpeg" href="'.qa_html( $this->content['description'] ).'" />');
        }

我正在尝试进行调整,以便当用户单击出现在 facebook 内 gif 中的左下角按钮时,他将被重定向到发布页面。 pinterest 函数使用以下参数并且运行良好。

$this->output('<a class="share-badge pinshare" href="//www.pinterest.com/pin/create/button/?url='.qa_html( $shareurl ).'&amp;media='.qa_html( $this->content['description'] ).'&amp;description="

我的问题是如何将 pinterest 代码适配到 facebook 分享代码,使其在 facebook 分享上工作,在用户点击网站地址时在用户时间线上显示原生 gif 将被重定向到相关出版物。就像在 pinterest 上一样

PS:.qa_html ($ this-> content ['description']).是文件的最终地址

ps:pinterest 工作正常 有人可以帮我解决这个问题吗?提前致谢。欢迎任何帮助。

完整代码主题 https://pastebin.com/mXNfewVW


facebook 分享器和社交功能代码:(代码更改)

   function socialshare()
    {
        $pagetitle=strlen($this->request) ? strip_tags($this->content['title']) : '';
        $headtitle=(strlen($pagetitle) ? ($pagetitle) : '');
        $shareurl= qa_path_html(qa_q_request($this->content['q_view']['raw']['postid'], $this->content['q_view']['raw']['title']), null, qa_opt('site_url'));

        $this->output('<div class="share-overlay">');
        $this->output('<a  title="Share on Facebook" href="https://www.facebook.com/sharer/sharer.php?u='.qa_html( $this->content['description'] ).'" target="_blank" rel="nofollow" onclick="javascript:window.open(this.href, \'_blank\', \'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600\');return false;">');
        $this->output('<i class="fab fa-facebook"></i></a>');
        $this->output('<a class="share-badge twitter" href="http://twitter.com/share?text='.qa_html( $headtitle ).'&amp;url='.qa_html( $shareurl ).'" title="Share on Twitter" rel="nofollow" target="_blank" onclick="avascript:window.open(this.href, \'_blank\', \'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600\');return false;"><i class="fab fa-twitter"></i></a>');

            $this->output('<a class="share-badge pinshare" href="//www.pinterest.com/pin/create/button/?url='.qa_html( $shareurl ).'&amp;media='.qa_html( $this->content['description'] ).'&amp;description=" title="Pin It" target="_blank" onclick="javascript:window.open(this.href, \'\', \'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600\');return false;"><i class="fab fa-pinterest"></i></a>');

        $this->output('</div>');
    }

您可以通过添加此内容轻松做到这一点

$this->output('<meta property="og:url" content="'.$this->content['description'].'" />');

您将 运行 遇到由于最后的 CID 而无法正确调用 giphy 的问题,因此您需要让它从 filename.gif 之后的任何内容中剥离数据。

您可以在这里轻松地做到这一点:

`

$re = '/(?<=gif).*/';
$str = $this->content['description'];
$subst = '';
$result = preg_replace($re, $subst, $str);`
$this->output('<meta property="og:url" content="'.$result.'" />');

Place this code in /root/king-theme/YOURTHEME/king-theme.php and above the $this->output('<meta property="og:type" content="article" />');

字体:dafitime https://kingsupport.kingthemes.net/