reg expression to change image width and height -HeLP Please!

Discussion in 'PHP' started by fdoze, Feb 8, 2012.

  1. #1
    Hi,

    I need a reg expression to change IMG, IFRAME, Flash OBJECT and other HTML TAGS width and height...


    This does not seem to be working:

    preg_replace('/<img.*src="(.*?)".*\/?>/', '<img src="\1"  width="300px" height="*" />', $txtText);
    PHP:
    preg_replace('/<iframe.*src="(.*?)".*\/?>/', '<iframe width="300px" height="*" frameBorder="0" src="\1"></iframe>', $txtText);
    PHP:
    Flash Object?!
    PHP:
    Could you please help me?
     
    fdoze, Feb 8, 2012 IP
  2. fdoze

    fdoze Peon

    Messages:
    205
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Anyone??

    Some solution or some link to help me...
     
    fdoze, Feb 9, 2012 IP
  3. awood969

    awood969 Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    40
    #3
    This problem would be much easier solved using JavaScript. Using the jQuery library you could simply do $("img").css("width", "300px"); etc etc. This way the client will process it which will take the processing off your servers and will do the job very nicely.

    Thanks
    Andrew
     
    awood969, Feb 9, 2012 IP
  4. fdoze

    fdoze Peon

    Messages:
    205
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I looking for reg exp to use under PHP...

    Thanks,
     
    fdoze, Feb 13, 2012 IP