Jump to content

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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.