3

I want to get thumbnail of facebook videos from a given video ID .

I use the preg_match function to get facebook video ID from a given url retrieved from database

preg_match("~/videos/(?:t\.\d+/)?(\d+)~i", $value->url, $matches);
$video_id = $matches[1];
echo ' <div class="fb-video" data-href="https://www.facebook.com/facebook/videos/'.$video_id.'/"></div>';

I want to posted on website with something like this:

<img src="VIDEO_IMAGE.<?php echo $video_id ?>.jpg">

I don't know if it' posssible? !

Anas Amine
  • 115
  • 1
  • 2
  • 6

1 Answers1

4

Your image source is wrong try using

<img src="https://graph.facebook.com/VIDEO_ID/picture" />

Example : https://graph.facebook.com/10153231379946729/picture

Moxet Khan
  • 235
  • 1
  • 9
  • Thank you so much! you saved my life :D and how about getting a large or medium image size ? is there any possible way to do it? – Anas Amine Aug 27 '15 at 17:06
  • @AnasAmine there is only two type of thumb in fb, small and big. Small can be grabbed easily with the link below; but big has some issue. Please check my answer here http://stackoverflow.com/questions/31773155/how-to-get-big-facebook-video-thumbnail/32168767?noredirect=1#comment52234918_32168767 – Moxet Khan Aug 29 '15 at 08:01