Created
August 24, 2017 13:22
-
-
Save yanknudtskov/3e79a83662da76a4af9f1aa3aad04530 to your computer and use it in GitHub Desktop.
Getting YouTube Preview Image
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