function video_embed_instagram_handle_thumbnail in Video Embed Instagram 7
Retrieve the thumbnail for the instagram video.
Parameters
string $url: This is string witch user input into video field.
Return value
array|bool Return FALSE if fails to get id from instagram.
1 string reference to 'video_embed_instagram_handle_thumbnail'
File
- ./
video_embed_instagram.module, line 136 - Add a handler for instagram videos to Video Embed Field.
Code
function video_embed_instagram_handle_thumbnail($url) {
$id = _video_embed_instagram_get_video_id($url);
if ($id) {
$image_url = 'http://instagr.am/p/' . $id . '/media/?size=l';
$request = drupal_http_request($image_url);
if ($request->code == 200 && !empty($request->redirect_url)) {
return array(
// Generally the id that the provider uses for the video.
'id' => $id,
// The url of the thumbnail.
'url' => $request->redirect_url,
);
}
else {
drupal_set_message(t('Error with getting thumbnail of the video.'), 'error');
}
}
return FALSE;
}