Resize YouTube Video

08 Dec

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


$embed = ‘‘;

//$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:

1 Comment

Posted by on December 8, 2009 in Uncategorized


Tags: , , , , , , ,

One response to “Resize YouTube Video

  1. admin

    February 14, 2011 at 6:36 am

    This code used here to resize embed code from



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: