Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A better YouTube endpoint to grab media information #16

Open
butchewing opened this issue Apr 18, 2016 · 2 comments
Open

A better YouTube endpoint to grab media information #16

butchewing opened this issue Apr 18, 2016 · 2 comments

Comments

@butchewing
Copy link
Contributor

The current YouTube endpoint is:

http://www.youtube.com/oembed?url={:canonical}&format=json

But, the image is only 480 x 270. It would be great if we could use:

http://img.youtube.com/vi/{:id}/maxresdefault.jpg

This would allow a much larger image (906x510).

@Sommerregen
Copy link
Owner

That's right. Unfortunately, MediaEmbed is currently not as flexible as I wish. Adding a service like Grav\Plugin\MediaEmbed\Services\GitHub should be possible.

However, I strive for a complete rewrite of code base and currently collect ideas.

@butchewing
Copy link
Contributor Author

I ended up hacking it. I changed the thumbnail function in mediaembed/classes/OEmbed/OEmbed.php to:

  public function thumbnail()
  {
    $thumbnail = '';
    if ($this->oembed) {
        $thumbnail = 'http://img.youtube.com/vi/'.$this->id().'/maxresdefault.jpg';
        //$thumbnail = $this->oembed->get('thumbnail_url', '');
    }
    return $thumbnail;
  }

It works like a charm. Take a look at the large video thumbnail here.

butchewing added a commit to butchewing/grav-plugin-mediaembed that referenced this issue May 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants