简体   繁体   中英

uploaded image files have width and height values switched, bewildering

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?

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

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

http://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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM