1

I got a lot of examples here how to get Youtube image. But if video is non-standard format, for example, vertical, black frame appears on the image.

I found interesting link on this site where it can be cut by GET query: http://img.youtube.com/vi/XkOpbLBzPsY/hqdefault.jpg

http://img.youtube.com/vi/XkOpbLBzPsY/hqdefault.jpg?custom=true&w=196&h=110&stc=true&jpg444=true&jpgq=90&sp=68&sigh=Gv-oyTIgA39e7UG01pZ2RiGbwSo

.. I tried out with my image, but nothing happened, and not any info on what these parameters are for.

The question is: if we can do that as in above urls, how can I get these parameters info? If not, is there any other way to remove black frame?

Is it possible to get such clear image if we know Youtube code only?

Pete
  • 57,112
  • 28
  • 117
  • 166
shustr8
  • 93
  • 7

2 Answers2

3

You're looking for the 16:9 yt:aspectratio format of the youtube thumbnail. Try using the image URL provided in this SO thread:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/mqdefault.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/maxresdefault.jpg

Tried this and it works. Hope that helps.

Community
  • 1
  • 1
ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
0

So finally I could do by:

<a href="#">
    <div style="background:url(<?php echo $url ?>) center no-repeat;
                background-size:cover;
                height:100px;
                width:50px;">
    </div>
</a>

Unfortunately not with the help of youtube api.

shustr8
  • 93
  • 7