get image width and height

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

get image width and height

Post by psychotomus »

how can i get a images width and height?
method_man
Forum Contributor
Posts: 257
Joined: Sat Mar 19, 2005 1:38 am

Post by method_man »

Code: Select all

<html>
<body>

<p>
<img src=&quote;blah.gif&quote;
width=&quote;20&quote; height=&quote;20&quote;>
</p>

<p>
<img src=&quote;blah.gif&quote;
width=&quote;45&quote; height=&quote;45&quote;>
</p>

<p>
<img src=&quote;blah.gif&quote;
width=&quote;70&quote; height=&quote;70&quote;>
</p>

//You can make a picture larger or smaller changing the values in the &quote;height&quote; and &quote;width&quote; attributes of the
img tag.//

</body>
</html>
I think this is what you are talking about :D

matt
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I think he needs

http://ca3.php.net/manual/en/function.getimagesize.php

Code: Select all

$info = getimagesize($image);

//info now contains the dimenisions of the image
echo '<pre>'.print_r($info).'</pre>';
Post Reply