Keyword

Problem with image share on facebook

  • Dimitris
  • Dimitris's Avatar Topic Author
  • Offline
  • New Member
More
8 years 6 months ago #152043 by Dimitris
Problem with image share on facebook was created by Dimitris
Hello,

Every time i try to share an article on facebook always the second image is selected and not the image that i set from image tab.

Any suggestions?

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #152044 by Javi Mata
Replied by Javi Mata on topic Problem with image share on facebook
when share in facebook a site need configure some meta's like this:

<meta property="og:url" content="www.nytimes.com/2015/02/19/arts/international/when-great-minds-dont-think-alike.html" />
<meta property="og:type" content="article" />
<meta property="og:title" content="When Great Minds Don’t Think Alike" />
<meta property="og:description" content="How much does culture influence creative thinking?" />
<meta property="og:image" content="static01.nyt.com/images/2015/02/19/arts/international/19iht-btnumbers19A/19iht-btnumbers19A-facebookJumbo-v2.jpg" />

Twitter: @Javi_Mata
Web: www.javimata.com

Please Log in or Create an account to join the conversation.

  • Dimitris
  • Dimitris's Avatar Topic Author
  • Offline
  • New Member
More
8 years 6 months ago #152045 by Dimitris
Replied by Dimitris on topic Problem with image share on facebook
Hello,

Thank you for your reply.

How do i do that from k2?

Heew is an example of an article from the website :
beautymag.tips/nailsh/item/67-dye-another-day

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #152048 by Javi Mata
Replied by Javi Mata on topic Problem with image share on facebook
try edit the component layout adding this in the top:

$doc =& JFactory::getDocument();
$doc->setMetaData( 'og:image', $this->item->image );

the another meta's are added automatic

Twitter: @Javi_Mata
Web: www.javimata.com

Please Log in or Create an account to join the conversation.

  • Dimitris
  • Dimitris's Avatar Topic Author
  • Offline
  • New Member
More
8 years 6 months ago #152049 by Dimitris
Replied by Dimitris on topic Problem with image share on facebook
You meen in this file?

components/com_k2/views/item/view.html.php

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #152050 by Javi Mata
Replied by Javi Mata on topic Problem with image share on facebook
nop, in components/com_k2/templates/default/item.php

after of: defined('_JEXEC') or die;

$doc =& JFactory::getDocument();
$doc->setMetaData( 'og:image', $this->item->image );

BEST be if add a new folder in templates/html/com_k2/[A LAYOUT]/item.php

create a folder in templates/html/com_k2/with a name like: articles (or every you want)

copy all files of components/com_k2/templates/default/ to the new folder, then in the category panel change the layout to this

and the change do it in the file item.php in the new folder, this is a override layout

Twitter: @Javi_Mata
Web: www.javimata.com

Please Log in or Create an account to join the conversation.

  • Dimitris
  • Dimitris's Avatar Topic Author
  • Offline
  • New Member
More
8 years 6 months ago #152051 by Dimitris
Replied by Dimitris on topic Problem with image share on facebook
Thank you very much,

I will do it and let you know what happened.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 6 months ago #152067 by Krikor Boghossian
Replied by Krikor Boghossian on topic Problem with image share on facebook
The og tags are present by default.
Make sure that another extension is not printing its own.
I would not suggest editing core files, since you will lose all edits when you update.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Dimitris
  • Dimitris's Avatar Topic Author
  • Offline
  • New Member
More
8 years 6 months ago #152379 by Dimitris
Replied by Dimitris on topic Problem with image share on facebook
Hello,
I didn't try the solution suggested by Javi because of what Krikor said.
The problem is still present. Unless i debug the link with facebook debugger images sometimes wont work at all. Even after debugging the images wont work again after some time.
The only extension that could cause problem is JCH optimize but i think i have set it correctly.

Website is : beautymag.tips

Any suggestions?

Thank you.

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago - 8 years 6 months ago #152551 by Martin Rother
Replied by Martin Rother on topic Problem with image share on facebook
I have the same issue. I tried the suggestion from Javi Mata and get the following error in facebook debugger.
imgur.com/2Gv6mm7

There are no more open graph tag generating plugins installed. og:image is still missing even with disabled jch optimized.

Joomla 3.5, K2 2.7
item.php: only order of a few sections changed.

view.html.php is original
// Set Facebook meta data
		if($params->get('facebookMetatags', '1'))
		{
			$document = JFactory::getDocument();
			$uri = JURI::getInstance();
			$document->setMetaData('og:url', $uri->toString());
			$document->setMetaData('og:title', (K2_JVERSION == '15') ? htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8') : $document->getTitle());
			$document->setMetaData('og:type', 'article');
			$facebookImage = 'image'.$params->get('facebookImage', 'Small');
			if ($item->$facebookImage)
			{
				$basename = basename($item->$facebookImage);
				if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.$basename))
				{
					$image = JURI::root().'media/k2/items/cache/'.$basename;
					$document->setMetaData('og:image', $image);
					$document->setMetaData('image', $image);
				}
			}
			$document->setMetaData('og:description', strip_tags($document->getDescription()));
		}
The only thing i noticed is the 'Small'. I have choosen Large in K2 Backend.
('facebookImage', 'Small')

Thank you
Last edit: 8 years 6 months ago by Martin Rother.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum