Title: marnickmenting's Replies | WordPress.org

---

# marnickmenting

  [  ](https://wordpress.org/support/users/marnickmenting/)

 *   [Profile](https://wordpress.org/support/users/marnickmenting/)
 *   [Topics Started](https://wordpress.org/support/users/marnickmenting/topics/)
 *   [Replies Created](https://wordpress.org/support/users/marnickmenting/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/marnickmenting/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/marnickmenting/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/marnickmenting/engagements/)
 *   [Favorites](https://wordpress.org/support/users/marnickmenting/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Plugin: Thumbnail For Excerpts] Any way to create thumbnails for videos?](https://wordpress.org/support/topic/plugin-thumbnail-for-excerpts-any-way-to-create-thumbnails-for-videos/)
 *  [marnickmenting](https://wordpress.org/support/users/marnickmenting/)
 * (@marnickmenting)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/plugin-thumbnail-for-excerpts-any-way-to-create-thumbnails-for-videos/#post-1006272)
 * 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)