angelino Hi. Ok, I believe itwill do the same what my script did, but we can do it this way.
I do have a function which extract image from text:
function imageExtract( $text ) {
$imagePath = '';
if( preg_match( '/\<img.*src=.*?\>/', $text )):
$imageStartPosition = JString::strpos( $text, 'src="' );
if( $imageStartPosition):
$imageEndPosition = JString::strpos( $text, '"', $imageStartPosition + 5 );
endif;
if( $imageStartPosition > 0 ):
$imagePath = JString::substr( $text, ( $imageStartPosition + 5 ), ( $imageEndPosition - ( $imageStartPosition + 5 ) ) );
print '';
endif;
endif;
return $imagePath;
} // eof imafeExtract()
copy it above the changes advice and than replace the image value to:
<meta property="og:image" content="'.imageExtract( $this->item->fulltext ).'"/>