Topic-icon open graph update

Active Subscriptions:

None
7 years 7 months ago #59715 by evil
open graph update was created by evil
Hello,
since the open graph protocol has been updated with this new values:

og:image:secure_url - An alternate url to use if the webpage requires HTTPS.
og:image:type - A MIME type for this image.
og:image:width - The number of pixels wide.
og:image:height - The number of pixels high.

How we can enhance JFB connect with these new necessary meta? We are issuing some problems posting on facebook: the image without height and width meta, is not rendering in the first preview.
The topic has been locked.
Support Specialist
7 years 7 months ago #59726 by mel
Replied by mel on topic open graph update
Could you try the following snippet:

In /libraries/sourcecoast/openGraph.php, after line 382, please add the following block:
if($this->name == 'og:image')
{
   list($width, $height) = getimagesize($tagValue);
   $graphValue .= '<meta property="og:image:width" content="' . $width . '"/>' . CARRIAGE_RETURN;
   $graphValue .= '<meta property="og:image:height" content="' . $height . '"/>' . CARRIAGE_RETURN;
}

We need to test this more thoroughly and make sure it is robust enough, but let me know how it works for you. I've added an issue to our tracker for this.

-Melissa
The topic has been locked.
Active Subscriptions:

None
7 years 7 months ago #59736 by evil
Replied by evil on topic open graph update
hi Mel, are you sure to put this code after 382? We have a return after 382
File Attachment:
The topic has been locked.
Support Specialist
7 years 7 months ago #59739 by mel
Replied by mel on topic open graph update
No, sorry for being confusing :) The code I'm looking at is from the master of our code repository, so it may be different than the latest 7.0.4 branch. It will be inside the block and will look like this:
//Add twitter first, so only first image is added to twitter
   $graphValue .= '<meta property="' . $this->name . '" content="' . $tagValue . '"/>' . CARRIAGE_RETURN;  // <-- This code is already there
   
   if($this->name == 'og:image') // <!-- This is the new code to add
   {
      list($width, $height) = getimagesize($tagValue);
      $graphValue .= '<meta property="og:image:width" content="' . $width . '"/>' . CARRIAGE_RETURN;
      $graphValue .= '<meta property="og:image:height" content="' . $height . '"/>' . CARRIAGE_RETURN;
   }
}
return $graphValue;
The topic has been locked.
Active Subscriptions:

None
7 years 7 months ago #59754 by evil
Replied by evil on topic open graph update
with this hack, the whole website is not working.

please, make a first attempt on your platform, then when it is working i'll be pleased to test in our environment
The topic has been locked.
Support Specialist
7 years 7 months ago #59755 by mel
Replied by mel on topic open graph update
Yes, I tested that code on my test site before posting to the thread and it properly added the image height and width open graph tags.

1. Are there any errors on the page?
2. Could you double-check the permissions of the folder and the image itself?
3. Could you verify that you have the PHP option "allow_url_fopen" enabled? This looks to be a requirement of the getimagesize method.
The topic has been locked.
Active Subscriptions:

None
7 years 7 months ago #59769 by evil
Replied by evil on topic open graph update
no errors on the page, only a completely blank page.

checked permissions and are ok.
The topic has been locked.
Support Specialist
7 years 7 months ago #59773 by mel
Replied by mel on topic open graph update
A blank page usually indicates a php error. Could you PM me FTP / backend credentials?

-Melissa
The topic has been locked.
Active Subscriptions:

None
7 years 7 months ago #59873 by evil
Replied by evil on topic open graph update
That's not so easy,

is it possible to get an installable package so we could test in our beta platform?
The topic has been locked.
Support Specialist
7 years 6 months ago #59882 by alzander
Replied by alzander on topic open graph update
If you can't provide FTP credentials, can you do the following:
* In the Joomla Global Configuration area, set "Error Reporting" to maximum. That should show an error message on the blank page along with a line number indicating where the problem is. Look at that line, or let us know the full error message.
* Take a picture, like you did above of the code, that you inserted into the page.

For quick patches, we don't generate full packages for users. Our development branch is always being worked on, so making an installer would include additional code that would likely cause other issues. Additionally, in this case, we're trying to help you with a new feature, so we need some feedback from you on if it work and any problems you encounter. We can do some diagnosis on your site with FTP, but if that's not available, you'll need to help us understand what's wrong.

Otherwise, if you'd prefer to wait for a whole release, we should have an update out later this year that will include this update.

Thanks,
Alex
The topic has been locked.