public function FacebookAlbumController::getPhoto in Facebook Album 8
Fetch an individual photo url from a Facebook album photo
Parameters
$photo_id:
Return value
\Zend\Diactoros\Response\JsonResponse
1 string reference to 'FacebookAlbumController::getPhoto'
File
- src/
Controller/ FacebookAlbumController.php, line 163 - Contains \Drupal\facebook_album\Controller\FacebookAlbumController.
Class
- FacebookAlbumController
- Controller for Facebook Album.
Namespace
Drupal\facebook_album\ControllerCode
public function getPhoto($photo_id) {
$json_response = array(
'data' => NULL,
);
$parameters = [
'fields' => 'images,name',
];
$response = $this
->makeRequest($photo_id, $parameters);
if (!isset($response['error'])) {
$json_response['data']['url'] = $response['images'][0]['source'];
$json_response['data']['name'] = isset($response['name']) ? $response['name'] : '';
}
return new JsonResponse($json_response);
}