I was wondering how can I find the width of an image using php.
+3
A:
Easy, you can use getimagesize:
list($width, $height) = getimagesize($filename);
igorw
2010-07-18 00:28:04
A:
You can try with this code, you can see more in www.php.net
To a file:
<?php
list($width, $height, $type, $attr) = getimagesize("img/flag.jpg");
echo "<img src=\"img/flag.jpg\" $attr alt=\"getimagesize() example\" />";
?>
To URL:
<?php
$size = getimagesize("http://www.example.com/gifs/logo.gif");
$size = getimagesize("http://www.example.com/gifs/lo%20go.gif");
?>
Only you have to give an output to variable.
Josh Ruiz
2010-07-18 00:37:27