Thursday, May 3, 2012

[YouTube-API] Re: How to get the 120px/90px thumbnail using Oembed.

Hello,

Please see my response at

https://groups.google.com/group/youtube-api-gdata/browse_thread/thread/aff14c36d2fb485a#

Cheers,
-Jeff Posnick, YouTube API Team
groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
@YouTubeDev


On Apr 29, 7:58 pm, georgiagirl <deuces...@gmail.com> wrote:
> still no answer anywhere. Would love some help with this.
>
>
>
>
>
>
>
> 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>
> >       <?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 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