486663 Joomla share on Facebook preview thumbnail and text fix

This project was awarded to urcoder for $85 USD.

Get free quotes for a project like this
Employer working
Awarded to:
Project Budget
Total Bids
Project Description

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;

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online