In opengraph_meta.common.inc line 558 the default image style "thumbnail" is declared:

    if (is_array($fields)) {
      if (!empty($fields['filemime']) && FALSE !== stripos($fields['filemime'], 'image') && !empty($fields[$_uri_field])) {
        $url = $fields[$_uri_field];
        if (7 <= OPENGRAPH_META_DRUPAL_VERSION)
          $url = image_style_url('thumbnail', $fields[$_uri_field]);

In most installations the thumbnail image preset generates images of 100 x 100px. Facebook, however, requires images of minimum 200 x 200px as the object debugger explains:

Tiny og:image: All the images referenced by og:image must be at least 200px in both dimensions. Please check all the images with tag og:image in the given url and ensure that it meets the minimum specification.

So when you for instance like a post, no image is simply displayed, therefore consider enabling custom preset settings or another hardcoded preset.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

q2_faith’s picture

I think this module must made own preset 200x200

nlisgo’s picture

As an interim I suggest that we allow users to select their own default image style for the og:image tag.

See attached patch. Facebook does indeed give a warning that images should not be less than 200px in height and width but even with a module specific image style that would achieve that it is better to allow users to select which image style default they want for the og:image enabling them to present the image as they want.

nlisgo’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Status: Active » Needs review
chlarkkirby’s picture

any updates on this?

Erik Seifert’s picture

Small Fix:

    if (is_array($fields)) {
      if (!empty($fields['filemime']) && FALSE !== stripos($fields['filemime'], 'image') && !empty($fields[$_uri_field])) {
        $url = $fields[$_uri_field];
        if (7 <= OPENGRAPH_META_DRUPAL_VERSION)
         // $url = image_style_url('thumbnail', $fields[$_uri_field]);
        $url = image_style_url(variable_get('openmeta_tags_style','thumbnail'), $fields[$_uri_field]);

Now you can set your style in settings.php

$conf['openmeta_tags_style'] = 'my_image_style';

So you have a simple configuration

ataxia’s picture

Thank you so much, erikseifert! Although I VERY RARELY will hack a contributed module, I used the fix in #5 and it resolved everything.

The thumbnail size for images on the site I'm working on are very small, but they are used throughout the site, so changing the thumbnail to a larger size broke a lot of other layouts.

This Facebook developer page was very helpful in being able to see what was going on: https://developers.facebook.com/tools/debug

After you paste a URL on that page, look at the Open Graph Warnings that Should Be Fixed section:

Small og:image: All the images referenced by og:image should be at least 200px in both dimensions, with 1500x1500 preferred. (Maximum image size is 5MB.) Please check all the images with tag og:image in the given url and ensure that it meets the recommended specification.

og:image should be larger: Provided og:image is not big enough. Please use an image that's at least 200x200 px. Image 'http://mysite.com/sites/default/files/styles/large/public/Screen%20Shot%...' will be used instead.

In the Raw Open Graph Document Information section, you can see which image was deemed 'too small':

Meta Tag: <meta property="og:image" content="http://mysite.com/sites/default/files/styles/thumbnail/public/NY90647.jpeg?itok=Cshdvp4u" />

I think 1500x1500 is crazy huge, so I used a 620px width image format size and that works fine.

- ataxia

Erik Seifert’s picture

Without hacking hook_html_head_alter is your friend:

http://api.drupal.org/api/drupal/modules!system!system.api.php/function/...

Erik Seifert’s picture

Issue summary: View changes

.

markkus69’s picture

Same issue. Help?

gnuget’s picture

Issue summary: View changes

is this still an issue?

I can't even find that code in the 7.x-1.4 version.

And seems to metatag doesn't apply a preset anymore in the image.

caspervoogt’s picture

Yes this is still an issue. I was using 7.x-1.3 and then switched to 7.x.-1.x-dev, and both were affected. I applied the patch, which solved it for me. I am unaware of a 7.x.-1.4 release though.

gnuget’s picture

hahaha, sorry I was looking in the wrong module. Ignore #9 please :-p

torotil’s picture

Status: Needs review » Fixed

I've just committed a fix that changes the behavior to always link the "original" image. This should fix the immediate issue with the 100x100 thumbnail image-style. I think there is a feature request for making the image-style configurable.

  • torotil committed 93bbaeb on 7.x-1.x
    Issue #2311015, #1720716 Store internal file-paths if possible. Use...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

tamer.kamel’s picture

There is a small change you can replace the thumbnail by the orginial image you uploaded.

AntiNSA’s picture

With the different patch verssions, can someone point me which patch is still effective for d6 version? Can you roll this into a d6 patch? Thanks!

a.milkovsky’s picture

Status: Closed (fixed) » Needs review
FileSize
1.14 KB
-          $url = image_style_url('thumbnail', $fields[$_uri_field]);
+          $thumb_url = image_style_url('thumbnail', $fields[$_uri_field]);

#12 does not fix the issue. Image is still a thumbnail.
#15 fixes the issue.
#16 please open a new issue for d6

I improved #15 to store relative path. It is good for different environments.
Path is converted to absolute at render process. @see OpenGraphMeta::render_data()

Please review.

caspervoogt’s picture

The following lines in opengraph_meta.common.inc cause '404 not found' images in our multilingual Drupal site;

$url_parts = parse_url($url);
$relative_url = $url_parts['path'];

... because the images wind up with the language code in the URL, which is an invalid path. E.g. http://www.somesite.com/en/sites/default/files/myimage.png rather than http://www.somesite.com/sites/default/files/myimage.png

I have for now changed this to;

//$url_parts = parse_url($url);
$relative_url = $url;

This works for us.

sarathkm’s picture

#5 is a quick fix for D7.

arnoldbird’s picture

re: #5, the variable name should incorporate the module's machine name, like so...

$style_name = variable_get('opengraph_meta_image_style', 'thumbnail');
$url = image_style_url($style_name, $fields[$_uri_field]);

UPDATE: The latest dev code uses a variable name that incorporates the module machine name:
http://cgit.drupalcode.org/opengraph_meta/commit/?id=3dcff6d64e1568d8684...

aludescher’s picture

Rewrite of #17 with proper file paths.

torotil’s picture

I’m about to drop support for 7.x-1.x (or 7.x-1.3 specifically). Is anyone willing to step up as a maintainer of the 7.x-1.x branch?