Skip to content

Instantly share code, notes, and snippets.

Created June 17, 2013 23:39
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/5801482 to your computer and use it in GitHub Desktop.
<?php
if ( get_post_meta($post->ID, 'video', true) ){
echo '<img src="';
$src = the_field('video');
preg_match('!video\/([0-9]+)!i', $src, $match);
$id = $match[1];
$apiurl = 'http://vimeo.com/api/v2/video/' . $id . '.json';
$response = file_get_contents($apiurl);
$json = json_decode($response, true);
print_r($json[0]['thumbnail_large']);
echo '">';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment