Welcome to WebmasterWorld Guest from 54.167.40.25

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Capturing Image Properties

     
8:48 pm on Aug 25, 2006 (gmt 0)

New User

5+ Year Member

joined:Aug 3, 2006
posts:33
votes: 0


Could someone please tell me how I can capture the height and width of an image and insert the values into variables?

Thank you.

8:58 pm on Aug 25, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 12, 2005
posts:5966
votes: 0



$image = "image.jpg";
$info = [url=http://us3.php.net/manual/en/function.getimagesize.php]getimageinfo[/url]($image);
$width = $info[0];
$height = $info[1];

You can also use other methods. Good luck!

9:07 pm on Aug 25, 2006 (gmt 0)

New User

5+ Year Member

joined:Aug 3, 2006
posts:33
votes: 0


Sweet..thank you.
3:52 am on Aug 26, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 27, 2003
posts:732
votes: 0


If you have the image loaded in memory, you can use imageSX($img) and imageSY($img).
6:50 am on Aug 26, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member dreamcatcher is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 30, 2003
posts:3719
votes: 0


And just so there is no confusion:

$info = getimageinfo($image);

Should be:

$info = getimagesize($image);

dc