Link to home
Create AccountLog in
Avatar of light_tuner
light_tuner

asked on

change the width value of an embedded video using preg_replace or similar

Dear all,
I have been looking at a simple solution to change the width (and height, but I imagine once I know for the width it is easy to change the height in the same manner) of embedded videos.

I can't imagine it is difficult, but I just can't get my head around regular expressions.

Thank you in advance
example of embedded video code:
 
<object width="446" height="326"><param name="movie" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf"></param><param name="allowFullScreen" value="true" /><param name="wmode" value="transparent"></param><param name="bgColor" value="#ffffff"></param> <param name="flashvars" value="vu=http://video.ted.com/talks/embed/JohnMaeda_2007-embed_high.flv&su=http://images.ted.com/images/ted/tedindex/embed-posters/JohnMaeda-2007.embed_thumbnail.jpg&vw=432&vh=240&ap=0&ti=172" /><embed src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" pluginspace="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" bgColor="#ffffff" width="446" height="326" allowFullScreen="true" flashvars="vu=http://video.ted.com/talks/embed/JohnMaeda_2007-embed_high.flv&su=http://images.ted.com/images/ted/tedindex/embed-posters/JohnMaeda-2007.embed_thumbnail.jpg&vw=432&vh=240&ap=0&ti=172"></embed></object>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Ionut A. Tudor
Ionut A. Tudor
Flag of Romania image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of light_tuner
light_tuner

ASKER

Hi al3cs12,

thanks a lot for your post. it does what it supposed to do (i.e. changing width end height) but using the example I provided, it crops the video.

Is there a way to scale the video to match the size I am setting?

Thanks
just to make sure (and my apology if I didn't formulate my question properly)
how would I go about scaling the width and height according to the desired width?

I imagine I would need to know both values to get the ratio and then deduce the new height from the width I set?

Thanks again
I think changing &vw=432&vh=240 parameters should do the trick
those parameters are set in the url, because the object and embed width and height automatically resizes the movie, but that parameters in the url &vw=432&vh=240 also sets the width and height, you need to replace these also. Good luck