You are here

function facebook_album_ajax_get_photo_url in Facebook Album 7.2

Same name and namespace in other branches
  1. 7.3 facebook_album.module \facebook_album_ajax_get_photo_url()

Fetch an individual photo url from a Facebook album photo

Parameters

$id:

Return value

json

1 string reference to 'facebook_album_ajax_get_photo_url'
facebook_album_menu in ./facebook_album.module
Implements menu_hook()

File

./facebook_album.module, line 271

Code

function facebook_album_ajax_get_photo_url($id) {
  $settings = facebook_album_get_settings();
  $module_response = array(
    'data' => null,
  );
  $url = _facebook_album_build_api_request($id, array(
    'access_token' => $settings['appToken'],
    'fields' => 'images,name',
  ));
  $response = _facebook_album_fetch_api_response($url);
  if (!isset($response['error'])) {
    $module_response['data']['url'] = $response['images'][0]['source'];
    $module_response['data']['name'] = isset($response['name']) ? $response['name'] : '';
  }
  return drupal_json_output($module_response);
}