Jump to content

changing the width and height of the embed code


scvinodkumar

Recommended Posts

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

 

 

 

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.