You are here

public static function ShareaholicPublic::get_image_url_for in Share Buttons, Related Posts, Content Analytics - Shareaholic 8

Same name and namespace in other branches
  1. 7.3 public.php \ShareaholicPublic::get_image_url_for()

Get image used in a piece of content

Return value

mixed either returns a string or false if no image is found

2 calls to ShareaholicPublic::get_image_url_for()
ShareaholicPublic::insert_content_meta_tags in ./public.php
Inserts the shareaholic content meta tags on the page On all pages, it will insert the standard content meta tags On full post pages, it will insert page specific content meta tags
ShareaholicPublic::insert_og_tags in ./public.php
Insert the Open Graph Tags

File

./public.php, line 241

Class

ShareaholicPublic
This class is all about drawing the stuff in publishers' templates that visitors can see.

Code

public static function get_image_url_for($node) {
  if (isset($node->field_image['und']['0']['uri'])) {
    return file_create_url($node->field_image['und']['0']['uri']);
  }
  if (isset($node->field_simage['und']['0']['uri'])) {
    return file_create_url($node->field_simage['und']['0']['uri']);
  }
  if (isset($node->body) && isset($node->body['und']['0']['value'])) {
    return self::post_first_image($node->body['und']['0']['value']);
  }
}