【发布时间】:2018-02-28 12:01:54
【问题描述】:
我正在使用以下内容通过 functions.php 文件从 Wordpress 中的 Vimeo 视频生成缩略图:
function get_vimeo_thumb($id, $size = 'thumbnail_small')
{
if(get_transient('vimeo_' . $size . '_' . $id))
{
$thumb_image = get_transient('vimeo_' . $size . '_' . $id);
}
else
{
$json = json_decode( file_get_contents( "http://vimeo.com/api/v2/video/" . $id . ".json" ) );
$thumb_image = $json[0]->$size;
set_transient('vimeo_' . $size . '_' . $id, $thumb_image, 2629743);
}
return $thumb_image;
}
然后在我的主题文件中添加以下内容:
<?php
echo '<img src="' . get_vimeo_thumb(43096888) . '">';
?>
但我现在想使用 oEmbed 链接来获取数据:
https://vimeo.com/api/oembed.json?url=https%3A//vimeo.com/43096888
我需要的参考是 thumbnail_url 但我不知道如何获取它。
谢谢。
【问题讨论】: