Image Function

Discussion in 'PHP' started by adamjblakey, Feb 27, 2012.

  1. #1
    Hi,

    I need to php function which searches for an image in a string and if this image has a set width changes the width to e.g. 250 wide or if the image has no set width it add for at 250.

    the string might be something like this:

    
    <h3>test</h3><br />	<img src="http://mydomain.co.uk/uploads/images/thumbs/53723328.jpg" width="157" align="right" style="margin-left:10px;">THERMAL <br>
    
    some text here<br>
    
    BEST SELLERS.<br>
    
    
    HTML:
    Regards,
    Adam
     
    adamjblakey, Feb 27, 2012 IP
  2. webshore88

    webshore88 Well-Known Member

    Messages:
    131
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    123
    #2
    You mean image must re-size in width 250px, what ever its original width is?
     
    webshore88, Feb 27, 2012 IP
  3. adamjblakey

    adamjblakey Active Member

    Messages:
    1,121
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    #3
    Hi,

    Thanks for your reply.

    I just need width="250" adding to the <img tag or if there is already a width="" then this changing to 250.

    Regards,
    Adam
     
    adamjblakey, Feb 28, 2012 IP
  4. webshore88

    webshore88 Well-Known Member

    Messages:
    131
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    123
    #4
    dude you can do it javascript/jquery very easily why do you want to do it in PHP? If you share your php code then I can suggests you more about your problem.
     
    webshore88, Mar 4, 2012 IP
  5. adamjblakey

    adamjblakey Active Member

    Messages:
    1,121
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    #5
    There is currently no code doing this. There is just a field called content in the database which is being printed onto the page.
     
    adamjblakey, Mar 4, 2012 IP