/ Published in: PHP
I\'ve added an additional case to handle videos linked from a user\'s channel.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * Creates a YouTube thumbnail URL from a YouTube video URL */ function youtube_video_thumbnail($url,$index=0){ return 'http://img.youtube.com/vi/'.$matches[1].'/'.$index.'.jpg'; return 'http://img.youtube.com/vi/'.$matches[2].'/'.$index.'.jpg'; }else{ return false; } }