how to do resize the image

Discussion in 'PHP' started by dawilster, Sep 5, 2008.

  1. #1
    in this code:
    
    print "<center><td><img src='".$info['image'] . "' ></a></td></center> ";
    
    Code (markup):
    how do i make the code resize the image to width="640" height="480"

    thanks
     
    dawilster, Sep 5, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Put the width and height attributes in the <img> tag?
     
    nico_swd, Sep 5, 2008 IP
  3. gameOn

    gameOn Member

    Messages:
    624
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    35
    #3
    
    print "<center><td><img src='".$info['image'] . "'  width='640' height='480'></a></td></center> ";
    
    Code (markup):
    hope this helps
     
    gameOn, Sep 5, 2008 IP
  4. wdillsmith

    wdillsmith Peon

    Messages:
    37
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If you are only dealing with standard formats, like gif, jpg, tiff, bmp, etc., you should consider using getimagesize. This will return the actual height and width, which you can then include as height and width values as the other posters mentioned. That way you don't have to constantly look up the image sizes, and if they change, your page will automatically update. The only downside is if you are trying to show an image and force the dimensions to be something other than the actual values.
     
    wdillsmith, Sep 5, 2008 IP