We can get the vide开发者_C百科o thumb of YouTube videos by using the video ID in an URL the way defined below
$src = "http://img.youtube.com/vi/".$video_id."/default.jpg";
Similarly, how can I get the video thumb of Facebook videos? Is there any predefined URL in which we put the Facebook video ID and get the as like youtube defined in the way above?
Trying to do this as well but it does not appear so. Example: a video I have on a Page with ID "1015030122022040" has a thumbnail url of:
http://vthumb.ak.fbcdn.net/hvthumb-ak-ash2/51388_10150301225830401_10150301220220401_62962_1470_t.jpg
While another video with ID: 10150361184550401
has a thumbnail url of:
http://vthumb.ak.fbcdn.net/hvthumb-ak-snc4/162098_10150361242815401_10150361184550401_35242_2053_t.jpg
I looked through others and found no obvious pattern. You can however do an FQL to return the array of videos by uid.
Using some code from a tutorial, I edited the "sql query example" in Step Three to this:
try {
//get user id
$uid = $facebook->getUser();
//or you can use $uid = $fbme['id'];
$fql = "SELECT vid, owner, title, description, thumbnail_link, embed_html, updated_time, created_time FROM video WHERE owner=" . $uid;
$param = array(
'method' => 'fql.query',
'query' => $fql,
'callback' => ''
);
$fqlResult = $facebook->api($param);
}
catch(Exception $o){
d($o);
}
Then from his example was able to the view the arrays <?php d($fqlResult); ?>
And grabbed my most recent video thumbnail thusly:
<img src="<?php echo $fqlResult[0][thumbnail_link]; ?>" />
check this :http://www.cutevideoclub.com/php/facebook-video-thumbnail-with-video-id-php/
$fbvideoid="158952527492492"; $fql2 = "SELECT vid, owner, title, description, thumbnail_link, embed_html, updated_time, created_time FROM video WHERE vid=" . $fbvideoid;
use above query for detail see ref site:http://www.cutevideoclub.com/php/facebook-video-thumbnail-with-video-id-php/
or click here facebook video thumbnail with video id php
精彩评论