View Full Version : Mini Mods - RedInk Design - Smart OG Image Tag
redinkdesign
12-09-2012, 11:00 PM
Currently vBulletin's facebook open graph image tag uses what's entered in Options -> Facebook Options -> Image URL. If you leave this field blank, the <og:image> meta tag is omitted and Facebook's crawler will try to use any image found on the page.
This mod looks for the first [img] or [attach] tags in a post and uses that image for the <og:image> meta tag. This will tell facebook's crawler to use that image for the post.
This mod requires the Facebook Platform to be enabled on vBulletin (Options -> Facebook Options -> Enable Facebook Platform).
It will first look for an [img] tag is the post, if none is found, it will look for an [attach] tag. If neither is found, it will use the Image you entered in the facebook options (Options -> Facebook Options -> Image URL). If that field was left empty, it will omit the <og:image> tag which is default vBulletin behavior.
This was only tested on 4.2.0 (PL3).
Installation:
Admin -> Plugin & Products -> Manage Products -> Add/Import Product
Update 12/4/2013
Changed image priorities - avatar and site logo are not priority
Update 11/19/2013
Plugin updated to support multiple images
sweetpotato
12-11-2012, 02:39 PM
Installed and work fine for me
Thanks,
Waiter
01-10-2013, 06:08 PM
excuseme, I installed this product but when do you config the og:image tag??
redinkdesign
01-10-2013, 06:11 PM
This mod looks for the first [img] or [attach] tags in a post and uses that image for the <og:image> meta tag. This will tell facebook's crawler to use that image for the post.
You don't explicitly set the og:image tag.
Waiter
01-10-2013, 06:22 PM
I made the importation and left blank the FB Image URL, but When you create the page, the tag og: image is omitted, but there are images in the the page (article of CMS Content) :(
sweetpotato
01-11-2013, 08:24 AM
This mod works fine for forum thread but not work for cms article
Waiter
01-11-2013, 08:36 AM
If you want it to work with the CMS articles, what should I change in the XML? There I took a look and the only thing I've noticed is that these variables: $GLOBALS['threadinfo']['description']. There is a variable that identifies those items of CMS?
tpearl5
01-12-2013, 06:27 PM
OMG, thank you I have been looking for this forever!
tpearl5
01-12-2013, 06:44 PM
crap fb_opengraph_array isn't a hook in my version of vbulletin
tpearl5
01-12-2013, 07:34 PM
Okay, I just inserted the plugin manually into functions_facebook.php since there isn't a comparable hook.
@Waiter - $vbulletin->options['description'] is the variable, but I don't believe it includes img and attach tags for the cms.
Waiter
01-15-2013, 02:48 PM
not work for CMS :(
Any idea for this? Thx :)
sticky
01-16-2013, 06:22 AM
Finally! Been waiting for something like this.
As long as this works on the CMS I'm good :)
Testing.
sticky
01-16-2013, 06:24 AM
This mod looks for the first [img] or [attach] tags in a post and uses that image for the <og:image> meta tag. This will tell facebook's crawler to use that image for the post.
You don't explicitly set the og:image tag.
Why does the facebook platform need to be enabled for this to work? Shouldn't it just work regardless?
Waiter
01-16-2013, 02:24 PM
Finally! Been waiting for something like this.
As long as this works on the CMS I'm good :)
Testing.
but this don't work in CMS :(
abdobasha2004
01-16-2013, 02:49 PM
I need this mod for vb 3.7 pleeeeeeeeeease......
sticky
01-16-2013, 04:31 PM
but this don't work in CMS :(
If you're promoting a forum post why not?
Waiter
01-18-2013, 10:43 AM
because the article of CMS are automatic connect with the page of Facebook and Twitter, by RSS....if I use the forum post, I don't use the custom Meta Desciption and Key :(
LifesGreatestGift
01-18-2013, 01:05 PM
Works great. Suggestion for future version.
A switch selection in admincp options that say
1) First Image
2) Provide Array
1) First Image is exactly as this mod acts.
2) Provide Array - would take all IMG and ATTACH in first post, and convert them all to
<meta property="og:image" content="http://example.com/image1.jpg" />
<meta property="og:image" content="http://example.com/image2.jpg" />
that way, when a thread is posted it will give you the option to choose the pic.
LifesGreatestGift
01-18-2013, 01:13 PM
your mod doesn't account for if the site is http or https properly
had to change this line
$og_array['og:image'] = 'http://' . $img_str;
to
$og_array['og:image'] = 'https://' . $img_str;
sticky
01-19-2013, 10:56 PM
because the article of CMS are automatic connect with the page of Facebook and Twitter, by RSS....if I use the forum post, I don't use the custom Meta Desciption and Key :(
I'm not quite sure I understand as if this replaces the tags when you promote the post the new tags should be there and in RSS.
redinkdesign
01-21-2013, 04:51 PM
Good catch, I will fix this in the next release.
your mod doesn't account for if the site is http or https properly
had to change this line
$og_array['og:image'] = 'http://' . $img_str;
to
$og_array['og:image'] = 'https://' . $img_str;
Bob_R
01-26-2013, 09:10 PM
So this only works for posts?
What about threads, showdisplay and forumhome?
Thanks!
Bob_R
01-29-2013, 05:26 PM
Doesn't work.
redinkdesign
01-29-2013, 05:40 PM
So this only works for posts?
What about threads, showdisplay and forumhome?
Thanks!
This is just an extension of the default vBulletin behavior.
Doesn't work.
What doesn't?
Bob_R
02-01-2013, 06:21 PM
This is just an extension of the default vBulletin behavior.
What doesn't?
Doesn't post image. it's just a blurry green arrow. :confused:
sticky
02-04-2013, 10:07 PM
Why does this require the facebook platform to be enabled?
tpearl5
02-05-2013, 12:39 AM
Why does this require the facebook platform to be enabled?
Because og tags are not inserted on vbulletin without the fb platform enabled.
Bob_R
02-13-2013, 07:42 PM
Why is everyone asking if the Facebook Platform has to be enabled? If you have Facebook Connect wouldn't you need it enabled anyway?
sweetpotato
02-14-2013, 06:54 AM
I have a problem when using this Mod. When share a thread to Facebook, It does not show the thread tittle but the site name.
redinkdesign
02-14-2013, 02:43 PM
This mod does not alter existing OG tags, only the <og:image> tag. The issue you're having is with the default vBulletin tags.
I have a problem when using this Mod. When share a thread to Facebook, It does not show the thread tittle but the site name.
sweetpotato
02-14-2013, 05:02 PM
This mod does not alter existing OG tags, only the <og:image> tag. The issue you're having is with the default vBulletin tags.
I will double check with this. For the time being, when I share threads to Facebook, some show thread tittle and some show site name.
Thanks for the nice mod,
suko22
03-04-2013, 10:43 AM
Any chance for 3.8??
Or any suggestion to make first pic in post to be og:image??
Thanks!!
redinkdesign
03-04-2013, 01:49 PM
Sorry, I don't have a 3.8 installation to test, I would have to set one up.
By default this plugin grabs the first pic in the post and sets that as og:image. It will look for the first [img] tag.
Any chance for 3.8??
Or any suggestion to make first pic in post to be og:image??
Thanks!!
suko22
03-04-2013, 02:23 PM
Sorry, I don't have a 3.8 installation to test, I would have to set one up.
By default this plugin grabs the first pic in the post and sets that as og:image. It will look for the first [img] tag.
Thanks, the problem is that facebook is not showing any thumbnails when I share a post from my forum (vb 3.8).
I'm trying to force the first image of the post (with [IMG] bbcode) to become og: image, but don?t know how.
Bye!
suko22
03-04-2013, 02:25 PM
Any advice will be tremendously grateful, of course..
Bob_R
07-26-2013, 04:53 PM
So let me get this straight. If you have an image entered in (Options -> Facebook Options -> Image URL) this mod is useless?
final kaoss
07-26-2013, 06:33 PM
This mod is for VB4 NOT VB3.
Thanks, the problem is that facebook is not showing any thumbnails when I share a post from my forum (vb 3.8).
I'm trying to force the first image of the post (with [IMG] bbcode) to become og: image, but don?t know how.
Bye!
cdoyle
08-13-2013, 09:31 PM
This doesn't seem to be working for me, I have the plugin installed, and FB enabled.
But when you like a thread that has images, it posts to FB but no thumbnail is displayed.
Is there something else that I need to do?
I'm running VB Version 4.2
cdoyle
08-14-2013, 10:52 PM
anyone have any ideas?
redinkdesign
11-19-2013, 02:41 PM
It seems facebook now only supports images bigger than 200x200 for og:image tags.
Put your page url in https://developers.facebook.com/tools/debug and see what comes back.
This doesn't seem to be working for me, I have the plugin installed, and FB enabled.
But when you like a thread that has images, it posts to FB but no thumbnail is displayed.
Is there something else that I need to do?
I'm running VB Version 4.2
redinkdesign
11-19-2013, 02:43 PM
Plugin has been updated to support multiple images. It no longer grabs the first one, but grabs all. This allows you to pick which one you wish to be displayed when posting on facebook.
naveeid
12-04-2013, 01:59 PM
wow its great , its wonderful , solved my problem with facebook.
installed on 4.2.2 and nominated as mod of the month.
vbulletin need to improve its integiration with facebook.
paulket
12-26-2013, 01:36 PM
Plugin has been updated to support multiple images. It no longer grabs the first one, but grabs all. This allows you to pick which one you wish to be displayed when posting on facebook.
The new version only grabs the avatar from the first post in a thread on my 4.2.2 forum, there is no option to use other images in the thread.
jimsflies
01-06-2014, 03:57 PM
I'm running 4.2.1 and it doesn't seem to be working for me either. Its showing the og:image tag as the default image setup in adminCP.
I'd love to get this working.
Budget101
11-16-2015, 11:07 AM
The new version only grabs the avatar from the first post in a thread on my 4.2.2 forum, there is no option to use other images in the thread.
That's precisely the error I'm experiencing as well. Only the avatar displays- it looks like it's showing the correct image, but when you go to the FB post afterwards, the avatar is what is actually posted.
concepts
11-16-2015, 01:15 PM
Work PERFECTLY!!! :DD
James18
01-20-2016, 10:12 AM
Installed but ALL the descriptions are the same when posting to facebook.
Removed and deleted the plugin but the OG tags where still there. Had to delete the actual code from headerinclude to remove them.
Don't understand why someone just don't give you the actual code to include in the header for og image.
Ov3rrun
07-23-2016, 03:24 PM
Hi, thanks for mod. Latest version only show the avatar as OG image. Is there any fix?
I see on code and there only check for description content, the attachment added from the browse menu not appear on description code.
jokergameth
04-29-2020, 12:05 PM
Installed but ALL the descriptions are the same when posting to facebook.
try this
https://vborg.vbsupport.ru/showthread.php?t=266745
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.