486663 Joomla share on Facebook preview thumbnail and text fix

In Progress

We have Joomla [url removed, login to view] and we need a script to fix that problem:

when sharing a document on facebook the preview is set to the first image or the text it founds and that sometimes is not the same of the article.

I've found a script for wordpress but we need something similar for Joomla.

function set_default_image(){

global $post;

$image = str_img_src($post->post_content);

if($image != ""){

echo '<link rel="image_src" href="'. $image . '" />' . "\n";



add_action('wp_head', 'set_default_image');

function str_img_src($html) {

if (strpos($html, '<img') !== false) {

$imgsrc_regex = '#<\s*img [^\>]*src\s*=\s*(["\'])(.*?)\1#im';

preg_match($imgsrc_regex, $html, $matches);



if (is_array($matches) && !empty($matches)) {

return $matches[2];

} else {

return false;


} else {

return false;



Skills: Anything Goes, Facebook Marketing, Joomla, Social Networking, WordPress

See more: facebook preview joomla, joomla facebook preview, joomla facebook share thumbnail fix, wordpress preview, problem of facebook, img wordpress, html 5 img, facebook for wordpress, facebook preview script, thumbnail, share facebook, sharing script wordpress, script facebook post, joomla link article, similar joomla wordpress, facebook post script, joomla found, facebook share html, facebook image text, share facebook image, wordpress global post, facebook share thumbnail, share joomla facebook, share image facebook, facebook similar script

Project ID: #2232573

Awarded to:


please see pm

$85 USD in 1 day
(67 Reviews)