marnickmenting
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [Plugin: Thumbnail For Excerpts] Any way to create thumbnails for videos?What I did to get video thumbnails is pasting in thumbnailforexcerpts.php after:
//last try, for images with src without quotes if(empty($src)){ preg_match_all('~src=([^\'"]+) ~', $first_image, $matches); $src=$matches[1][0]; $srcorig=$matches[1][0]; }this code:
if(empty($src)){ // if no images found, try to find a youtube video preg_match_all('~\[youtube [^\>]*\]~', $content, $matches); // find the youtube quicktag $first_image = $matches[0][0]; preg_match_all('~\[youtube ([^\'"]+)\]~', $first_image, $matches); // extract the videoId if(!empty($matches[1][0])) { $src="http://img.youtube.com/vi/" . $matches[1][0] . "/2.jpg"; // get the thumbnail from the middle frame of the video $srcorig=$src; } } if(empty($src)){ // if no images found, try to find a vimeo video preg_match_all('~\[vimeo [^\>]*\]~', $content, $matches); // find the vimeo quicktag $first_image = $matches[0][0]; preg_match_all('~\[vimeo ([^\'"]+)\]~', $first_image, $matches); // extract the videoId if(!empty($matches[1][0])) { $hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/".$matches[1][0].".php")); // retrieve serialized data about video and put it in an array $src=$hash[0]['thumbnail_medium']; // show 200px thumbnail $srcorig=$src; } } if(empty($src)){ // if no images found, try to find a google video preg_match_all('~\[googlevideo [^\>]*\]~', $content, $matches); // find the googlevideo quicktag $first_image = $matches[0][0]; preg_match_all('~\[googlevideo ([^\'"]+)\]~', $first_image, $matches); // extract the videoId if(!empty($matches[1][0])) { $hash = file_get_contents("http://video.google.com/videofeed?docid=" . $matches[1][0]); // retrieve xml about video preg_match_all('~media:thumbnail url=[\'"]([^\'"]+)[\'"]~',$hash,$matches); // find thumbnail url in xml $src = $matches[1][0]; $srcorig=$src; } }This script will get the thumbnails from the video host servers, if there are no images found.
You should have VideoWarrior or similar plugin to use the [youtube videoId] tags.
Viewing 1 replies (of 1 total)