Skip to content

Instantly share code, notes, and snippets.

@chriscoyier
Forked from anonymous/gist:5801482
Last active December 18, 2015 14:59
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save chriscoyier/5801571 to your computer and use it in GitHub Desktop.
<?php
$src = '<iframe src="http://player.vimeo.com/video/68302803" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
$matches = preg_match('/player\.vimeo\.com\/video\/(\d+)/', $src, $match);
if ($matches) {
$id = $match[1];
$apiurl = 'http://vimeo.com/api/v2/video/' . $id . '.json';
$response = file_get_contents($apiurl);
$json = json_decode($response, true);
$thumbSRC = $json[0]['thumbnail_large'];
echo "<img src='$thumbSRC'>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment