How to get the image size of the uploaded image

A

Anonymous

Guest
Good Day!

how get the image size of the uploaded image? Can any ine help me?

I have a Code"

$file = $_FILES['image']['tmp_name'];

$image_size = getimagesize($file);

echo"$image_size";

it returns Array. How to get the value example 100x100?

Coz i want to test the uploadedmage that if it greater than 100x100 it will not uplaoded.

Help is greatly appreciated
 
Check the php manual for the getimagesize() function. It returns a lot more than just the image size and it returns the information formatted as an array, hence you get "array" as the result of your echo statement instead of what is actually contained within the array itself. You will need to use a foreach() statement to disect the different parts of the returned array into individual strings before you can use them the way that you want to.

Cheers!

fishermanjuice
 
Back
Top