<code>
<?php
require_once(ABSPATH.'wp-includes/class-oembed.php'); $oembed= new WP_oEmbed; $name = get_post_meta($post->ID,'video_code',true); $url = $name; //As noted in the comments below, you can auto-detect the video provider with the following $provider = $oembed->discover($name); //$provider = 'http://www.youtube.com/oembed'; $video = $oembed->fetch($provider, $url, array('width' => 300, 'height' => 175)); $thumb = $video->thumbnail_url; if ($thumb) { ?> <img src="<?php echo $thumb; ?>" width="120px" height="90px" /> <?php } ?>
</code>
-- You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/youtube-api-gdata/-/-EocFIWypDcJ.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.
No comments:
Post a Comment