Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write code to display youtube video thumbnails and Vimeo video thumbnails

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to write and display youtube video thumbnails and Vimeo video thumbnails code", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "how to write and display youtube video thumbnails and Vimeo video thumbnails code"!

The copy code is as follows:

Function video_image ($url) {

$image_url = parse_url ($url)

If ($image_url ['host'] = =' www.youtube.com' | |

$image_url ['host'] = =' youtube.com') {

$array = explode ("&", $image_url ['query'])

Return "http://img.youtube.com/vi/".substr($array[0], 2)." / 0.jpg "

} else if ($image_url ['host'] = =' www.youtu.be' | |

$image_url ['host'] = =' youtu.be') {

$array = explode ("/", $image_url ['path'])

Return "http://img.youtube.com/vi/".$array[1]."/0.jpg";

} else if ($image_url ['host'] = =' www.vimeo.com' | |

$image_url ['host'] = =' vimeo.com') {

$hash = unserialize (file_get_contents ("http://vimeo.com/api/v2/video/".)

Substr ($image_url ['path'], 1) .php))

Return $hash [0] ["thumbnail_medium"]

}

}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report