PHP get image width & height

To get the width and height of the image use getimagesize(path_name), this function returns the array which contains the height, width, image_type constant and other image related info. By the following code you can achive that.

list($width, $height) = getimagesize("file path");

if ($width > $height)
	// Portrait

See also PHP resize image using ratio

By Keenlio, September 25, 2014

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

five − = 4

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>