You are here

protected function SocialContentFacebook::getImageUrl in Social Content 7.2

Get the image url from a given row.

Parameters

object $row: The url of the image.

string $settings: The settings for this instance.

Return value

bool|string The URL, or FALSE on error.

1 call to SocialContentFacebook::getImageUrl()
SocialContentFacebook::prepareRow in modules/facebook/social_content_facebook.class.inc
Do the uploads and attach expected fields to a row about to be imported.

File

modules/facebook/social_content_facebook.class.inc, line 250
Social Content Facebook class.

Class

SocialContentFacebook
@file Social Content Facebook class.

Code

protected function getImageUrl($row, $settings) {
  if (isset($row->full_picture)) {
    $picture_url = $row->full_picture;
  }
  if (isset($row->object_id)) {
    $picture_url = $settings['graph_url'] . '/' . $row->object_id . '/picture';
  }
  else {
    $picture_url_parts = drupal_parse_url($row->full_picture);
    if (isset($picture_url_parts['query']['url'])) {
      $picture_url = $picture_url_parts['query']['url'];
    }
    if (isset($picture_url_parts['query']['src'])) {
      $picture_url = $picture_url_parts['query']['src'];
    }
  }
  if (!isset($picture_url)) {
    return FALSE;
  }
  return $picture_url;
}