Adjust height and width in embed code using php

Discussion in 'PHP' started by miexl, Sep 1, 2009.

  1. #1
    Hi,

    Can anyone here in DP would like to help me how to create a php script that will automatically adjust the width and height of embed code inputted by a user?

    looking forward for your help
     
    miexl, Sep 1, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    $code = preg_replace('/width=["\']?[0-9]+["\']?/i', 'width="500"', $code);
    $code = preg_replace('/height=["\']?[0-9]+["\']?/i', 'height="500"', $code);
    
    PHP:
     
    premiumscripts, Sep 1, 2009 IP