Keyword

Problem with image share on facebook

  • Dimitris
  • Dimitris's Avatar Topic Author
  • Offline
  • New Member
More
9 years 1 month 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
9 years 1 month 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
9 years 1 month 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
9 years 1 month 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
9 years 1 month 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
9 years 1 month 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
9 years 1 month 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
9 years 1 month 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.

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

  • Dimitris
  • Dimitris's Avatar Topic Author
  • Offline
  • New Member
More
9 years 1 month 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
9 years 1 month ago - 9 years 1 month 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: 9 years 1 month ago by Martin Rother.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 1 month ago #152633 by Krikor Boghossian
Replied by Krikor Boghossian on topic Problem with image share on facebook
@Dimitris,/
The image is retrieved propery -> developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fbeautymag.tips%2Fnailsh%2Fitem%2F67-dye-another-day

@Martin Are og tags enabled in your site?
Also I will need a link to your site.

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

More
9 years 1 month ago - 9 years 1 month ago #152635 by Martin Rother
Replied by Martin Rother on topic Problem with image share on facebook
@Krikor, yes, it is already enabled. only og:image is not there.
Medienportal Grimma
Example
Thank you
Last edit: 9 years 1 month ago by Martin Rother.

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

  • Dimitris
  • Dimitris's Avatar Topic Author
  • Offline
  • New Member
More
9 years 1 month ago #152639 by Dimitris
Replied by Dimitris on topic Problem with image share on facebook
The problem is that almost always the second image is retrieved, is there a way to set the main image (image set from image tab) to be selected for facebook share?

Thank you

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 1 month ago #152681 by Krikor Boghossian
Replied by Krikor Boghossian on topic Problem with image share on facebook
@Martin, Can you disable JCH Optimise and HTML minification please?

@Dimitris , make sure that the image size you have chosen meets OG's requirements.
developers.facebook.com/docs/sharing/best-practices

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

More
9 years 1 month ago - 9 years 1 month ago #152948 by Martin Rother
Replied by Martin Rother on topic Problem with image share on facebook

Martin Rother wrote: og:image is still missing even with disabled jch optimized.


I've also tried to change the ordering of system plugins.
Last edit: 9 years 1 month ago by Martin Rother.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 1 month ago #152970 by Krikor Boghossian
Replied by Krikor Boghossian on topic Problem with image share on facebook
By default the OG tags are enabled in K2, Can you turn them off to see if another extension is still generating these tags?

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

More
9 years 1 month ago #152975 by Martin Rother
Replied by Martin Rother on topic Problem with image share on facebook
No og's generated

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 1 month ago #152988 by Krikor Boghossian
Replied by Krikor Boghossian on topic Problem with image share on facebook
Can you send me a link to your site?

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

More
9 years 1 month ago #153000 by Martin Rother
Replied by Martin Rother on topic Problem with image share on facebook
Of course:
medienportal-grimma.de

JCH and minifying is active, at this time. I have also tried with disabled admin tools plugin, but admin tools does not affect the html code, i assume.

Thank you

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 4 weeks ago #153060 by Krikor Boghossian
Replied by Krikor Boghossian on topic Problem with image share on facebook
From what I can see, the image is loaded through a CDN (or a subfolder).
Which extension are you using for this functionality?
Can you temporarily (in a dev site of course) disable this setting?

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


Powered by Kunena Forum