// OpenGraph support
$template_config = new JConfig();
$uri = JURI::getInstance();
$article_attribs = json_decode($this->item->attribs, true);
$og_image = '';
if( preg_match( '/\<img.*src=.*?\>/', $this->item->text ) ){
$imgStartPos = JString::strpos( $this->item->text, 'src="' );
if( $imgStartPos ) $imgEndPos = JString::strpos( $this->item->text, '"', $imgStartPos + 5 );
if( $imgStartPos > 0 ) $og_image = JString::substr( $this->item->text, ( $imgStartPos + 5) , ( $imgEndPos - ( $imgStartPos + 5 ) ) );
}
$og_desc = strip_tags( $this->item->introtext );
$og_image = 'http://' . $_SERVER['SERVER_NAME'] . '/' . $og_image;
$og_title = $this->escape($this->item->title);
$og_type = 'article';
$og_url = $cur_url;
$og_site_name = $template_config->sitename;
if(isset($article_attribs['og:title'])) {
$og_title = ($article_attribs['og:title'] == '') ? $this->escape($this->item->title) : $this->escape($article_attribs['og:title']);
$og_type = $this->escape($article_attribs['og:type']);
$og_url = $cur_url;
$og_image = ($article_attribs['og:image'] == '') ? '' : $uri->root() . $article_attribs['og:image'];
$og_site_name = ($article_attribs['og:site_name'] == '') ? $template_config->sitename : $this->escape($article_attribs['og:site_name']);
$og_desc = $this->escape($article_attribs['og:description']);
}
$doc = JFactory::getDocument();
$doc->setMetaData( 'og:title', $og_title );
$doc->setMetaData( 'og:type', $og_type );
$doc->setMetaData( 'og:url', $og_url );
$doc->setMetaData( 'og:image', $og_image );
$doc->setMetaData( 'og:site_name', $og_site_name );
$doc->setMetaData( 'og:description', $og_desc );
is this a solution? if it is i try and not work