On Friday, April 27, 2012 10:39:10 AM UTC-4, georgiagirl wrote:
Im using Oembed to get the thumbnail of a video from a submitted url but it returns the 480px/360px size instead of the 120px/90px default version which is the size I use to display them. It's causing alot of unnecessary cropping so I'd like to know how I can the 120px/90px version using the code below.--<code><?phprequire_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/-/uQFzn6P_cD8J.
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