Resize YouTube Video

On December 8, 2009, in Uncategorized, by phpsolutions

Here is the code how to resize youtube video embed code, even this code will work to non-youtube embed videos…..

<?php

$embed = ‘<object width=”425″ height=”344″><param name=”movie” value=”http://www.youtube.com/v/jWDmG3JnNLE&hl=en_US&fs=1&”></param><param name=”allowFullScreen” value=”true”></param><param name=”allowscriptaccess” value=”always”></param><embed src=”http://www.youtube.com/v/jWDmG3JnNLE&hl=en_US&fs=1&” type=”application/x-shockwave-flash” allowscriptaccess=”always” allowfullscreen=”true” width=”425″ height=”344″></embed></object>’;

//$alt = preg_match_all(‘/(width|height)=(“[^”]*”)/i’, $embed, $matches);

$embed = preg_replace(‘/(width)=(“[^”]*”)/i’, ‘width=”200″‘, $embed);
$embed = preg_replace(‘/(height)=(“[^”]*”)/i’, ‘height=”200″‘, $embed);

echo $embed;

?>

Output here:

4 Responses to Resize YouTube Video

  1. Anonymous says:

    Certainly completely along with your conclusions and believe you’ve made some excellent points. Also, I prefer the layout of this site along with the easier navigation. I’ve bookmarked your website and will return often!

  2. Anonymous says:

    To be sure with all your thoughts here and I really love your website! I’ve bookmarked it in order that I will revisit & read more down the road.

  3. Anonymous says:

    Hello, Today inside a new directory of blogs. I don’t recognize how your site came up, have to have been a typo. Your website looks good, have a very nice day.

  4. Jaylee Winburn says:

    Thanks for the blog article.Really looking forward to read more. Really Great.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.