Get Image Height and Width as integer values?
Like this :
imageCreateFromPNG($var);
//I don't know where from you get your image, here it's in the png case
// and then :
list($width, $height) = getimagesize($image);
echo $width;
echo $height;
list($width, $height) = getimagesize($filename)
Or,
$data = getimagesize($filename);
$width = $data[0];
$height = $data[1];
Try like this:
list($width, $height) = getimagesize('path_to_image');
Make sure that:
- You specify the correct image path there
- The image has read access
- Chmod image dir to 755
Also try to prefix path with $_SERVER["DOCUMENT_ROOT"]
, this helps sometimes when you are not able to read files.
getimagesize() returns an array containing the image properties.
list($width, $height) = getimagesize("path/to/image.jpg");
to just get the width and height or
list($width, $height, $type, $attr)
to get some more information.