Resource icon

Facebook OpenGraph Image from [img] or [attach] tags 1.3

No permission to download

JulianD

Well-known member
JulianD submitted a new resource:

OpenGraph Image from [img ] or [ attach] tags - Use the first image found in a [ img] or [ attach] tag to populate the og:image field

By default XenForo uses a static image or the author's avatar in the open graph image metadata. This image is what Facebook displays when you share one of your forum's url.

Basically you end up with the same image over and over again when sharing a thread URL on Facebook.

This addon tries to solve this problem by replacing the og:image metadata with images found within or

Read more about this resource...
 
Last edited:
By 1 week facebook take my first image from post by default if there are no image in post it take default opengraph image, you don't need an addont for this, I think facebook make some change in opengraph algorithm.

edit:
Open Graph Warnings That Should Be Fixed
Inferred Property:The 'og:description' property should be explicitly provided, even if a value can be inferred from other tags.
og:image should be larger:provided og:image is not big enough. Please use an image that's at least 200x200 px. Image '***this is and external image url /first image from post which is bigger than 200x200 ***' will be used instead.

So if in first post you have an image much largest than 200x200x facebook will take it automaticaly.
 
Last edited:
By 1 week facebook take my first image from post by default if there are no image in post it take default opengraph image, you don't need an addont for this, I think facebook make some change in opengraph algorithm.

edit:
Open Graph Warnings That Should Be Fixed
Inferred Property:The 'og:description' property should be explicitly provided, even if a value can be inferred from other tags.
og:image should be larger:provided og:image is not big enough. Please use an image that's at least 200x200 px. Image '***this is and external image url /first image from post which is bigger than 200x200 ***' will be used instead.

So if in first post you have an image much largest than 200x200x facebook will take it automaticaly.

It doesn't seem to work like this to me. Facebook will always choose the same static image specified in the style properties. I'm glad it's been working fine to you though :)
 

Oh, I see what is going on.

1) Do you have a Facebook Application ID or a Facebook Page Admin defined in Options > Facebook Integration? If you don't, XenForo doesn't include the open graph meta data.
2) The first image doesn't work because you don't allow guest to download attachments
3) When you attached an image to the post, it is not enough for the addon to work. You have to actually insert an [attach ] tag to the message of the post.

I'm going to release an update to try to avoid an attached image if you don't allow guest to see attachments.
 
Oh, I see what is going on.

1) Do you have a Facebook Application ID or a Facebook Page Admin defined in Options > Facebook Integration? If you don't, XenForo doesn't include the open graph meta data.
2) The first image doesn't work because you don't allow guest to download attachments
3) When you attached an image to the post, it is not enough for the addon to work. You have to actually insert an [attach ] tag to the message of the post.

I'm going to release an update to try to avoid an attached image if you don't allow guest to see attachments.
Thank you replied enthusiastically.
I will look forward to your next version to the most recent one day.
 
This seems to only work when post a direct link. Doesn't work when using url shortening services.

Not your fault but still... (n)
 
is there a way to force it to use only img or attach tags from a shortened url?

For instance, if your twitter goes to your Facebook and you post a link to your twitter, the img and attach tags do not work.
 
Is working somehow but, you need to make some change in you open_graph_meta Template, than will be first image
So your open_graph_meta should look like it.
<xen:if is="{$xenOptions.facebookAppId} OR {$xenOptions.facebookAdmins}">
<meta property="og:site_name" content="{$xenOptions.boardTitle}" />
<meta property="og:image" content="{xen:helper fullurl, @ogLogoPath, 1}" />
<xen:if is="{$avatar}"><meta property="og:image" content="{$avatar}" /></xen:if>

<meta property="og:type" content="{xen:if $ogType, $ogType, article}" />
<meta property="og:url" content="{xen:raw $url}" />
<meta property="og:title" content="{xen:raw $title}" />
{xen:raw $ogExtraHtml}
<xen:if is="{$xenOptions.facebookAppId}"><meta property="fb:app_id" content="{$xenOptions.facebookAppId}" /></xen:if>
<xen:if is="{$xenOptions.facebookAdmins}"><meta property="fb:admins" content="{xen:helper implode, {$xenOptions.facebookAdmins}, ','}" /></xen:if>
</xen:if>
 
Last edited:
This seems to only work when post a direct link. Doesn't work when using url shortening services.

Not your fault but still... (n)

I don't know how to work that out since Facebook is the one taking such decisions.
Is working somehow but, you need to make some change in you open_graph_meta Template, than will be first image
So your your open_graph_meta should look like it.
Thanks for the suggestion. Makes sense!
 
I put your code above the avatar code and it is now registering the image or attachment first instead of an avatar.
 
In some posts, users don't insert attachment images to post content. So could you also handle this case?
 
Top Bottom