Jump to content
The Krotek Support Forum
  • Sign Up
ATHANASIOS ZISOPOULOS

Opengraph plugin error on image path need help!

Recommended Posts

Dear support i use your free Social Meta Tags i send you an example

page https://www.noizy.gr/cinema-theatre/articles/the-witcher

in the source code i get <meta property='og:image' content='https://www.noizy.gr/<img style="display: block; margin-left: auto; margin-right: auto;" src="/images/fakelos2k18/Noizy2k20/arthra20/thewitcher20/witcher2068.jpg" alt="witcher2068" />'>

Facebook reads the bellow link

src="/images/fakelos2k18/Noizy2k20/arthra20/thewitcher20/witcher2068.jpg and thinks its missing because it does not read the domain in front

and can not find the image its like the code is wrong "https://www.noizy.gr/<img style="display: block; margin-left: auto; margin-right: auto;"

the domain should be after the src/not before the <imag style= 

can you please help me to dfix this? so that src= redirects with the domain on it?

Thanks 

 

 

Share this post


Link to post
Share on other sites

there must be something wrong in the https:// statement

 if (!preg_match("/https?:\/\//i", $image)) {
                    $image = JUri::root().preg_replace("/^\//", "", $image);

 

====================================================

if ($this->params->get('opengraph_image', 1) || $this->params->get('twitter_image', 1)) {
            $image = '';

            if (!empty($item['image'])) {
                $image = $item['image'];
            } elseif (isset($item['description'])) {        
                preg_match_all("/<img.*?>/i", $item['description'], $images);

                if (!empty($images[0]))    {
                    foreach ($images[0] as $imagekey => $image) {
                        preg_match("/src=[\"|\']([^\"|\']+)/i", $image, $src);
                
                        $source = $src[1];

                        if (!preg_match("/https?:\/\//i", $source)) {
                            $source = JUri::root().preg_replace("/^\//", "", $source);
                        }

                        if ($imagekey == 0) {
                            $firstimage = $source;
                        }

                        if ($this->params->get('imageclass', '') && preg_match("/class=[\"|\'](.*)".$this->params->get('imageclass')."[\"|\']/i", $image)) {
                            $image = $source;
                            break;
                        }
                    }
                    
                    if (!$image) {
                        $image = $firstimage;
                    }
                }
            }
            
            if ($image) {
                if (!preg_match("/https?:\/\//i", $image)) {
                    $image = JUri::root().preg_replace("/^\//", "", $image);
                }
                
                if ($this->params->get('opengraph_image', 1)) {
                    $this->document->addCustomTag("<meta property='og:image' content='".$image."'>");
                }

 

Share this post


Link to post
Share on other sites

Something's wrong with your description. Feel free to edit plugin's code anyway you like.

If you want me to look into the issue, this will be a paid service.

Share this post


Link to post
Share on other sites

as i said my wesite when i use the plugin adds the domain before the <img style=

<meta property='og:image' content='https://www.noizy.gr/<img style="display: block; margin-left: auto; margin-right: auto;" src="/images/fakelos2k18/Noizy2k20/arthra20/thewitcher20/witcher2068.jpg" alt="witcher2068" />'>

i beleive the correct syntax of the path the plugin creates should be to show the link bellow ..

content='<img style="display: block; margin-left: auto; margin-right: auto;" src="https://www.noizy.gr/images/fakelos2k18/Noizy2k20/arthra20/thewitcher20/witcher2068.jpg" alt="witcher2068" />'>

thats the problem i have...  send me a quote for a fix even if this is not related with your plugin

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...