Thread: Image size

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Location
    Sweden
    Posts
    384
    Rep Power
    15
    Hello all,

    Does anybody know how to open an image (gif/jpg) end echo its size?

    I know the syntax for gifs, but it do not work on jpegs.

    Best regards,
    Christoffer
  2. #2
  3. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    62
    Right on the PHP web site it says the GetImageSize() function works on GIF, JPEG, or PNG files.
    http://www.php.net/manual/function.getimagesize.php3

    What syntax are you using?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Location
    Sweden
    Posts
    384
    Rep Power
    15
    IT WORKS!!! Thank you VERY much!!! :-)

    I was using this syntax:

    <?php
    // notice these are backticks (`), not quotes (')
    // the file function is called and fed the location of the gif file
    $output = `file /full/path/to/gif`;

    // the $output string contains lots of info, so we split it up by the ,'s.
    $vals = split( ",",$output);

    // we display a trimmed version of the third part, as taht contains the dimensions.
    // the [2] part is because array indexes start at 0, not 1
    echo trim($vals[2]);

    ?>

    Best Regards,
    Christoffer :-D

Similar Threads

  1. "Save for Web" image size reverts to original
    By Plohish in forum Photoshop Help
    Replies: 1
    Last Post: February 1st, 2004, 02:39 PM
  2. Replies: 2
    Last Post: December 20th, 2003, 11:56 AM
  3. Cropping Window to size of image.
    By Nada_Surf in forum HTML Programming
    Replies: 1
    Last Post: November 20th, 2003, 05:18 AM
  4. photoshop image size in inches
    By digdog in forum Photoshop Help
    Replies: 1
    Last Post: November 6th, 2003, 12:29 AM
  5. how to change image size in java scripts.
    By reeni in forum HTML Programming
    Replies: 3
    Last Post: October 17th, 2003, 07:14 AM

IMN logo majestic logo threadwatch logo seochat tools logo