Last active
June 18, 2018 06:24
-
-
Save yanknudtskov/dbdb1dee9abed73a9a8158263e34db5d to your computer and use it in GitHub Desktop.
Get Vimeo Video Thumbnail #vimeo
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_vimeo_video_id( $vimeo_url ) { | |
| // ----- http://stackoverflow.com/a/10489007/1291469 ----- // | |
| $video_id = (int) substr(parse_url($vimeo_url, PHP_URL_PATH), 1); | |
| return $video_id; | |
| } | |
| function get_vimeo_thumbnail( $vimeo_url ) { | |
| // ----- http://stackoverflow.com/a/1361192/1291469 ----- // | |
| $id = get_vimeo_video_id( $vimeo_url ); | |
| $hash = unserialize(file_get_contents("https://vimeo.com/api/v2/video/$id.php")); | |
| return $hash[0]['thumbnail_medium']; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment