khashnan / timthumb

Automatically exported from code.google.com/p/timthumb
0 stars 0 forks source link

Thumbnails from youtube videos #175

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I did this on my own but I just can't seem to make it right.
What would be perfect is that when the url is from youtube(whether it has 
V=VideoID or watch=VideoID or just embeded like this 
'http://www.youtube.com/embeded/VideoID , it would extract the videoID and 
change the url to this 'http://img.youtube.com/vi/VideoID/0.jpg' for original 
video size or 'http://img.youtube.com/vi/VideoID/1.jpg' for thumbnail size of 
the video.
I achieved this for embeded videos with this code:
$match = array();
if (ereg('http://www.youtube', get_request("src", "")) == true || 
ereg('http://youtube',get_request("src", "")) == true) {
   preg_match("/http\:\/\/www\.youtube\.com\/embed\/([\w-]{11})/", get_request("src", ""),$match);
      if($match[1] != false) {
      $src = 'http://img.youtube.com/vi/' . $match[1] . '/0.jpg';
      }
}
but somewhere during the extraction of the url this fails.
I attached the timthumb.php I am using.

regards.

Original issue reported on code.google.com by ermalipa...@gmail.com on 23 Mar 2011 at 12:37

Attachments:

GoogleCodeExporter commented 8 years ago
There is also a plugin that does this for you. 

http://wordpress.org/extend/plugins/youtube-thumbnailer/ 

Goodluck

Rene Jansen
http://www.one2traffic.nl

Original comment by rene-jan...@versatel.nl on 30 Mar 2011 at 12:58

GoogleCodeExporter commented 8 years ago
This has been in TimThumb since November last year (revision 101) so I'll flag 
as notbug

Original comment by BinaryMoon on 21 Apr 2011 at 10:05