I've just upgraded to 1.31 and now all my pages that have {{#setmainimage:}} on them, no longer have images in the open graph data. Anyone know how to make this work again?
Extension talk:OpenGraphMeta/Flow
Currently the same thing on mediawiki 1.32.0 extension does not seem to work properly, the image tag is not taken into account. I only have the following TAGs, using this extension:
<meta property="og:type" content="article"/>
<meta property="og:site_name" content="Analyse Développement Hacking"/>
<meta property="og:title" content="Accueil Utiliser MediaWiki"/>
<meta property="og:url" content="https://wiki.visionduweb.fr/index.php?title=Accueil_Utiliser_MediaWiki"/>
But, i have add the image !
I have installed this extension along with TwitterCards. All of the og tags seem to work minus the image tag. The image tag seems to only work on the homepage of the wiki. I have tried googling and tried every suggestion I've found but nothing seems to work at this point. Any help would be greatly appreciated.
I have the same problem. I installed Extension:PageImages and it works like a charm, since it automatically selects the best image for sharing.
I think this is because the generated og:image thumbnail is too small and Facebook refuses to display anything below 200x200. I have provided a fix in this comment.
Hello, currently, the extension does not seem to return any code Meta opengraph image. It would be no longer a problem of image size, but directly a problem of the extension.
I have only this Meta :
<meta property="og:type" content="article"/> <meta property="og:site_name" content="Analyse Développement Hacking"/> <meta property="og:title" content="Accueil Utiliser MediaWiki"/> <meta property="og:url" content="https://wiki.visionduweb.fr/index.php?title=Accueil_Utiliser_MediaWiki"/>
This extension should use the DISPLAYTITLE instead of the actual page title, if provided on the page.
When I put down {{#setmainimage:Filename.ext}} what I get in the og:image is not the actual image but a thumb of that image.
Example:
If I put down {{#setmainimage:Filename.png}} I get:
<meta property="og:image" content="http://sitename.com/wiki/images/thumb/5/5d/Filename.png/105px-Filename.png" />
instead of simply
<meta property="og:image" content="http://sitename.com/wiki/images/5/5d/Filename.png" />
Any ideas what can cause this?
It's coded like this, forcing a thumb that fits 300x100: https://github.com/wikimedia/mediawiki-extensions-OpenGraphMeta/blob/master/OpenGraphMeta.class.php#L76
I don't know why that restriction, though
Actually, 300x100 is now too small a value for Facebook, which required at least 200x200 for the og:image tag. I've submitted a bug on phabricator but if you want to fix the code yourself find OpenGraphMeta.class.php and change line 76 to:
$meta['og:image'] = wfExpandUrl( $mainImage->createThumb( 1200, 630 ) );
The bug was fixed in change 431322. For those still having an issue with this, simply reinstall the extension.
I tried to install this on mediawiki 1.27 and adding {{#setmainimage:Filename.ext}}
to all of my infoboxes but nothing is happening. When I try to share any of my pages it doesn't use the image that I set for it. I also checked the head of the page and it doesn't have an og:image
in the meta tags, but it seems to have the other og
: tags, such as og:type
, og:site_name
, og:title
, and og:url
.
I have modified 47 line of the OpenGraphMeta.php of the OpenGraphMeta extension from Title::newFromDBkey($data['dbkey'], NS_FILE) to Title::newFromText($data['dbkey'], NS_FILE) and the og:image in the meta tags seems to apear now, but it still not willing to use the infobox image for a few pages.
This didn't seem to output the correct format for the OG meta tags due to the addMeta function called with the BeforePageDisplay hook. Could be my fault. For example, I am getting <meta name="property:og:type" content="article" />
when it should be <meta property="og:type" content="article"/>
. Unless there's something I'm missing, addMeta will only return <meta name="$value1" content="$value2"/>
formatted meta tags.
I am on MediaWiki 1.18.0, PHP 5.2.17, and MySQL 5.1.56--maybe the function addMeta has changed in the latest update? I corrected it by using the hook OutputPageBeforeHTML and the function addHeadItem to output:
foreach( $meta as $property => $value ) {
if ( $value ){
$out->addHeadItem( "OGMeta$i", '<meta property="'.$property.'" content="'.$value.'"/>'.PHP_EOL );
$i++;
}
It seems to work. Thoughts?
This post was posted by Peachey88 (Flood), but signed as Lost Student.
Try the trunk or 1.17 version of the extension. The 1.18 version seams to contain a change made after the 1.17 branch but was reverted later on.
This post was posted by Peachey88 (Flood), but signed as Dantman.
Hi all, I have just tested this extension on a 1.15.4 MediaWiki installation and I had an error reporting:
Call to undefined method OutputPage::getTitle() in C:\server\xampplite\htdocs\wiki\extensions\OpenGraphMeta\OpenGraphMeta.php on line 65
Installation data:
- MW 1.15.4
- PHP 5.3.0
- MySQL 5.1.41
Extensions installed:
- MultipleUpload 1.0
- Cite r.37577
- DSADate 1.0
- DynamicPageList2 1.7.4
- ImageMap r.35980
- ImageSizeInfoFunctions 1.0.1
- MultipleUploadToolboxItem 0.1
- ParserFunctins 1.1.1
- PropertyTable2 1.2.1
- StringFunctions 2.0.1
- SyntaxHighlight
- GoogleTranslator 0.1
- NewUserEmailNotification 1.5.1
Moreover, inspecting the code, it seems that the extension Description2 is required for properly description tag be evaluated. Is my assumption correct? TIA
This post was posted by Peachey88 (Flood), but signed as Briotti.
Yes, Description2 has the parsing code to extract a description from the page so OpenGraphMeta uses it instead of duplicating code.
OutputPage::getTitle was added in 1.16; 1.15 is not a supported MediaWiki version anymore, it's no longer receiving security updates and some security holes have been fixed in later versions of MediaWiki. So I see no reason to add 1.15 compat.
This post was posted by Peachey88 (Flood), but signed as Dantman.
I have created a fork of this extension which integrates with Extension:PageImages, so that if both are installed, the intelligent prioritized and automated image selections made by that extension can apply to the og:image property in lieu of other forms of specification (this fork also fixes the php exceptions that are thrown by MediaWiki 1.24 if this extension is installed unmodified, due to there not being a form of Title::newFromDBkey that accepts two parameters). You can find the source code for the customized branch here.
Amazing, and amazing timing -- have been updating my wiki for OG starting a couple of days ago, and was scratching my head about how to sort out og:image without wrangling editors into manually doing it. This seems to work great! Only thing I wish I could do now is a mass-resave of articles on our wiki so that it could populate this faster.
You suggested in your description: "This works very nicely when you incorporate it into an infobox template making the infobox image the preferred image for 3rd parties to use"
How?
I tried to include it into my infobox: http://www.spd-geschichtswerkstatt.de/wiki/Vorlage:Person Yet the main image isn't set: http://www.spd-geschichtswerkstatt.de/wiki/Franz_Th%C3%B6nnes
I've added the extension to localsetting.php and then I clicked 'edit' and added the code {{#setmainimage:Sunset.jpg}}. However when I click 'facebook like' it doesn't use the image 'sunset.jpg' and I've checked the meta data and there it hasn't changed the og:image source. How do I use this extension? What am I doing wrong?
Try changing NewFromDBKey to NewFromTitle, this code seems to rely on an older(?) version of the Title class.
What are you talking about? Title::newFromDBKey still exists and always has. And since we have a DB key it's the right method to use. While Title::newFromTitle does not exist and is conceptually ridiculous.
Sorry, I just assumed that the reason this extensions doesn't seem to work with newer versions of MW was that it tried calling newFromDBkey like this Title::newFromDBkey($data['dbkey'], NS_FILE)
, whereas newFromDBkey now only seems to accept one parameter. Using newFromText instead, or something like Title::newFromDBkey( "File:" . $data['dbkey'] )
made it work for me. rotsee (talk) 19:02, 17 September 2012 (UTC)
This worked for me as well!! Thanks rotsee.
Thanks!
Is your wiki publicly available so I can debug?