• I use the blog style full option and i wanted to resize the video in the rss feed a load. I write a php code to resize all videos to fit my WordPress template, some was just to big or to small.
    here the code

    <?php
    
    /**
     * EMBED RESIZING
     *
     * This will let you resize all videos in a rss feed.
     *
     * If you don't want to do anything to the content, simply remove the function.
     */
    
    // We MUST keep this classname.
    class SimplePie_PostProcess
    {
    	// Function name MUST be the same as the template tag we're processing, all lowercase, and MUST accept a single string parameter.
    	function item_content($s)
    	{
    		// Match all images in the content.
    		// I would recommend the regex tool at http://osteele.com/tools/rework/ to do testing ahead of time.
    		if (preg_match('#(<(object)(.+?)</object>)#is',$s,$matches)) {
    
    		$embedcode = $matches[1];
    		$embedcode = str_replace("\\", "", $embedcode);
    		$embedcode = preg_replace('/width=(\'|\")(.*?)(\'|\")/', 'width="550"', $embedcode); #385
    		$embedcode = preg_replace('/height=(\'|\")(.*?)(\'|\")/', 'height="400"', $embedcode); #300
    		$s = preg_replace('#(<(object)(.+?)</object>)#is', $embedcode, $s);
    		}
    
    		// Return $s back out to the plugin.
    		return $s;
    	}
    }
    
    ?>

    i called this file embed.php and put it in the simplepie-plugin-for-wordpress plugin folder. You can choose the option in the simplepie admin section Content “Post-Processing Rules:”

  • The topic ‘Simplepie plugin processing resize video’ is closed to new replies.