scvinodkumar Posted August 14, 2009 Share Posted August 14, 2009 I have embed code stored in the database which comes from different video sites. Each embed code has their own width and height. Now i need to display the video with custom size(width,height). And i found, in some embed code they specified width and height like this style="width:704;height:524;" or width="704" height="524" For example, <p style="visibility:visible;"> <object type="application/x-shockwave-flash" style="width:704;height:524;" data="http://www.stagegold.com/SGFLV.swf?playerid=59" > <param name="movie" value="http://www.stagegold.com/SGFLV.swf?playerid=59" /> <param name="quality" value="high" /> <param name="scale" value="scale" /> <param name="salign" value="l" /> <param name="wmode" value="transparent"/> <param name="allowFullScreen" value="true"/> <param name="flashvars" value="playerid=59&autostart=false&autoplaylist=false&swidth=704&sheight=527&owidth=704&oheight=527&wmode=transparent"/> </object> </p> or <p style="visibility:visible;"> <object type="application/x-shockwave-flash" width="704" height="524" data="http://www.stagegold.com/SGFLV.swf?playerid=59" > <param name="movie" value="http://www.stagegold.com/SGFLV.swf?playerid=59" /> <param name="quality" value="high" /> <param name="scale" value="scale" /> <param name="salign" value="l" /> <param name="wmode" value="transparent"/> <param name="allowFullScreen" value="true"/> <param name="flashvars" value="playerid=59&autostart=false&autoplaylist=false&swidth=704&sheight=527&owidth=704&oheight=527&wmode=transparent"/> </object> </p> However the situation, i want to display the video with width=250 height=250 Please help me Quote Link to comment Share on other sites More sharing options...
MadTechie Posted August 14, 2009 Share Posted August 14, 2009 try this $data = "the html"; //replace width with height for height preg_match('/<object[^>]*width[:=]["\']?(\d+)/i', $data, $regs)) $width = $regs[1]; EDIT: if the code is ALWAYS width then heigh you could grab both at the same time Quote Link to comment Share on other sites More sharing options...
.josh Posted August 15, 2009 Share Posted August 15, 2009 $content = preg_replace('~((?:width|height)\s?[=:]\s?[\'"]?)[0-9]+~i','${1}250',$content); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.