Last active
June 18, 2018 06:24
-
-
Save yanknudtskov/f9c6e7554f5004a1868ab3e9c7510e18 to your computer and use it in GitHub Desktop.
Getting YouTube Preview Image #youtube
This file contains hidden or 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 | |
| function get_youtube_preview_image( $url ) { | |
| $vars = array(); | |
| parse_str( parse_url( $url, PHP_URL_QUERY ), $vars ); | |
| return 'https://img.youtube.com/vi/'.$vars['v'].'/hqdefault.jpg'; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment