Skip to content

Instantly share code, notes, and snippets.

@suth
Created May 9, 2012 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suth/2640615 to your computer and use it in GitHub Desktop.
Save suth/2640615 to your computer and use it in GitHub Desktop.
Facebook Thumbnail Class
class Facebook_Thumbnails extends Video_Thumbnails_Providers {
// Regex strings
public $regexes = array(
'#"http://www.facebook.com/v/([0-9]+)"#' // Facebook Embed
);
// Thumbnail URL
public function get_thumbnail_url( $id ) {
return 'https://graph.facebook.com/' . $id . '/picture';
}
// Test cases
public $test_cases = array(
array(
'markup' => '<object width=420 height=180><param name=allowfullscreen value=true></param><param name=allowscriptaccess value=always></param><param name=movie value="http://www.facebook.com/v/2560032632599"></param><embed src="http://www.facebook.com/v/2560032632599" type="application/x-shockwave-flash" allowscriptaccess=always allowfullscreen=true width=420 height=180></embed></object>',
'expected' => 'https://graph.facebook.com/2560032632599/picture',
'name' => 'Facebook'
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment