How does NGFB find / detect / select images?

The images used in the Open Graph meta tags for Posts and Pages are chosen in this sequence:

  1. An image defined in the Post or Page NGFB Social Settings metabox (Pro version).
  2. E-commerce product image(s) (Pro version).
  3. A featured or attached image from NextGEN Gallery or the WordPress Media Library (featured images are selected first).
  4. An image from the NextGEN Gallery ImageBrowser (in combination with an nggalbum or nggallery shortcode).
  5. A preview image from a NextGEN Gallery nggalbum or nggallery shortcode.
  6. Image(s) from expanded NextGEN Gallery singlepic, nggallery, nggtags or ngg_images shortcodes.
  7. Image(s) from <img/> HTML tags in the content text (see following for details).
  8. A default image defined in the NGFB General settings page.

When NGFB gets down to scanning the content in #7, it looks for:

  1. NextGEN Gallery <div|a|img/> HTML tags with the ‘data-ngg-pid’ or ‘data-image-id’ attribute.
  2. <img/> HTML tags with the ‘data-wp-pid’ attribute.
  3. Any other <img/> HTML tags with a ‘src’ attribute, and checking the image URL, it also tries to match a pre-v2 NextGEN Gallery image ID.

All of these methods will lead to a properly sized image of the correct dimensions (since the image ID can be determined), provided the original image is large enough. Always upload the largest images you can to the Media Library and/or NextGEN Gallery, and let WordPress create the re-sized / smaller versions as required. If an original image is smaller than the required Image Dimensions, it will be ignored by the plugin – so always upload the largest images possible.

The plugin also looks for any <img/> HTML tags in the content that have a a ‘width’ and ‘height’ attribute larger than the Image Dimensions setting.

A Note About Image Dimensions

NGFB provides several Image Dimension options, depending on the intended use for the image (Open Graph meta tags, various Twitter Card formats, etc.). The Image Dimensions should always be chosen for their intended use. For example, Open Graph meta tags are read by Facebook, Pinterest, Google+, LinkedIn, and others. Facebook has published a preference for images measuring 1200x630px, but horizontally cropped images may not show as well on Pinterest. A good compromise for your Open Graph Image Dimensions is 1200x1200px cropped. If you use these dimensions, make sure your original images are at least 1200px in both height and width.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>