1

Here is the html client form:

<form action="http://www.roncherry.com/ppmama/pictest.php" method="POST"   enctype="multipart/form-data">
       File(JPG) to Upload: <input type="file" name="fnpic" />
       <input type='submit' value='Save to Servers' />
</form>    

Here is the action php server code:

if ($_FILES["fnpic"]["name"]) {
list($width, $height) = getimagesize($_FILES["fnpic"]["tmp_name"]);
echo 'sizes are w= ' . $width . ' h= ' . $height;
}

Before upload width is 478, height is 640.
After upload width is 640, height is 478.
Upload works only problem is the dimension values.
Any ideas?

  • Not from this code - please post the actual upload and anything that is interfering with it ;) – kero Feb 05 '14 at 18:51
  • 1
    Some cameras will tag photos with the rotation of camera and then software might honor this tag and auto-rotate the image for display. This same software might also report height and width based upon this as well. Presumably getimagesize does not do this. – horatio Feb 05 '14 at 19:18

1 Answers1

0

The code you provided above is working correctly.. I just change the $_FILES["fnpic"]["tmp_name"] to the image location.

https://i.stack.imgur.com/EBNHJ.png

https://i.stack.imgur.com/dTNCM.png

Result:

sizes are w= 421 h= 516

You can refer to this post -> Get Image Height and Width as integer values?

Community
  • 1
  • 1
user3258603
  • 149
  • 2
  • 17