RSS

Tag Archives: resize youtube video

Resize YouTube Video

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

<?php

$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:
http://www.youtube.com/v/jWDmG3JnNLE&hl=en_US&fs=1&

 
1 Comment

Posted by on December 8, 2009 in Uncategorized

 

Tags: , , , , , , ,

Resize YouTube Embed Video

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/SOiGqFceMYo&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/SOiGqFceMYo&hl=en&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;

?>

Now try to resize youtube player with php regular expression replace preg_replace()……

 
13 Comments

Posted by on April 22, 2009 in 1, php

 

Tags: , , , ,