How to take video embed codes and change all their widths/heights?
| From: | Rob Gould | Date: | Tue, 15 Jan 2008 22:25:26 +0000 |
| Subject: | How to take video embed codes and change all their widths/heights? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-267334@lists.php.net to get a copy of this message | ||
Can anytime give me some insights on how to write a PHP script that could accept any of the below strings below and edit the strings to change their width and height settings dynamically?
For instance, if I want all embedded videos to have a width of 320, and a height of 240, using PHP's string manipulation commands, what's the best way to "hone in" on width="425" and change it to width="320"? (In all cases in each string)
stringtoedit='<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/B1O2jcfOylU&rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/B1O2jcfOylU&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>';
stringtoedit='<object width="464" height="388" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"><param name="movie" value="http://www2.funnyordie.com/public/flash/fodplayer.swf" /><param name="flashvars" value="key=5468" /><param name="allowfullscreen" value="true" /><embed width="464" height="388" flashvars="key=5468" allowfullscreen="true" quality="high" src="http://www2.funnyordie.com/public/flash/fodplayer.swf" type="application/x-shockwave-flash"></embed></object><noscript><a href="http://www.funnyordie.com/videos/5468">Cars</a> on <a href="http://www.funnyordie.com">FunnyOrDie.com</a></noscript>';