image - Determining dimensions of an uploaded photo using PHP

29

I was wondering if it is possible to get an uploaded images dimensions using PHP, so that I could set it as a potrait/landscape image, which would help in making thumbnails that don't look awful. Anyone know a way to do this?

Thanks!

418

Answer

Solution:

Sure:

list($width, $height) = getimagesize($image_path); 
843

Answer

Solution:

Sure, use getimagesize() on your uploaded file.

90

Answer

Solution:

Use: getimagesize() function

People are also looking for solutions to the problem: php - friendly url without any parameters with htaccess

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.