WordPress.org

Ready to get started?Download WordPress

Forums

Video Thumbnails
JetPack Compatability (2 posts)

  1. DanMichel
    Member
    Posted 3 years ago #

    It doesnt work with JetPack video embeds other than YouTube. I only use Vimeo

  2. 3dolab
    Member
    Posted 2 years ago #

    edit the plugin file video-thumbnails.php
    and replace the default Vimeo section with:

    // Vimeo
    		if($new_thumbnail==null) {
    
    			// Standard embed code
    			preg_match('#<object[^>]+>.+?http://vimeo.com/moogaloop.swf\?clip_id=([A-Za-z0-9\-_]+)&.+?</object>#s', $markup, $matches);
    			if(!isset($matches[1])) {
    				preg_match('#<object[^>]+.+?http://vimeo.com/moogaloop.swf\?clip_id=([A-Za-z0-9\-_]+)&.+?</object>#s', $markup, $matches);
    			}
    
    			// Find Vimeo embedded with iframe code
    			if(!isset($matches[1])) {
    				preg_match('#http://player.vimeo.com/video/([0-9]+)#s', $markup, $matches);
    			}
    
    			// If we still haven't found anything, check for Vimeo embedded with JR_embed
    			if(!isset($matches[1])) {
    		    	preg_match('#\[vimeo id=([A-Za-z0-9\-_]+)]#s', $markup, $matches);
    		    }
    
    			// If we still haven't found anything, check for Vimeo URL
    			if(!isset($matches[1])) {
    			preg_match('#http://w?w?w?.?vimeo.com/moogaloop.swf\?clip_id=([A-Za-z0-9\-_]+)#s', $markup, $matches);
    		    }
    			if(!isset($matches[1])) {
    		    	preg_match('#http://w?w?w?.?vimeo.com/([A-Za-z0-9\-_]+)#s', $markup, $matches);
    
    		    }
    
    			// If we still haven't found anything, check for Vimeo shortcode
    			if(!isset($matches[1])) {
    		    	preg_match('#\[vimeo clip_id="([A-Za-z0-9\-_]+)"[^>]*]#s', $markup, $matches);
    
    		    }
    			if(!isset($matches[1])) {
    		    	preg_match('#\[vimeo video_id="([A-Za-z0-9\-_]+)"[^>]*]#s', $markup, $matches);
    		    }
    			if(!isset($matches[1])) {
    		    	preg_match('#\[vimeo ([A-Za-z0-9\-_]+)*]#s', $markup, $matches);
    		    }
    		//echo '<pre>MATCH:';print_r($matches[1]);echo '</pre>';
    			// Now if we've found a Vimeo ID, let's set the thumbnail URL
    			if(isset($matches[1])) {
    				$vimeo_thumbnail = getVimeoInfo($matches[1], $info = 'thumbnail_large');
    				if(isset($vimeo_thumbnail)) {
    					$new_thumbnail = $vimeo_thumbnail;
    				}
    			}
    		}

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic