-
-
Save INDIAN2020/2838de160c89ab48bf3a2ff6d38e6a72 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