Created
October 27, 2011 05:30
-
-
Save staydecent/1318851 to your computer and use it in GitHub Desktop.
Vimeo or YouTube thumb link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!ctype_digit($videolink)) : | |
// has chars other than digits == YouTube | |
?> | |
<div class="video column six<?php echo ($video_count === $last) ? ' last' : ''; ?>"> | |
<a class="videopopup" href="http://youtube.com/v/<?php echo $videolink; ?>"> | |
<img src="http://img.youtube.com/vi/<?php echo $videolink; ?>/0.jpg"> | |
</a> | |
</div> | |
<?php | |
else: | |
// Vimeo | |
// http://vimeo.com/api/v2/video/video_id.output | |
$vimeo_url = 'http://vimeo.com/api/v2/video/'.$videolink.'.json'; | |
$vimeo = json_decode(curl_get($vimeo_url)); | |
?> | |
<div class="video column six<?php echo ($video_count === $last) ? ' last' : ''; ?>"> | |
<a class="videopopup" href="http://player.vimeo.com/video/<?php echo $videolink; ?>"> | |
<img src="<?php echo $vimeo[0]->thumbnail_large; ?>"> | |
</a> | |
</div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment