getimagesize()函数不适用于5K图像吗?

时间:2018-08-22 13:34:43

标签: php image function size getimagesize

男人看看这个gif。 https://gfycat.com/IllustriousThirdLamb

我将等待您的解决方案。

PHP

if (isset($_POST["submit"])) {
    $img = $_FILES["img"]["tmp_name"];
    $size = $_FILES["img"]["size"];
    $getRes = getimagesize($img);
    echo "Image height : ".$getRes[0]."px<br>";
    echo "Image width : ".$getRes[1]."px<br>";
}

问题已解决。谢谢

2 个答案:

答案 0 :(得分:0)

您需要增加PHP的内存限制

php_value memory_limit 16M 
ini_set('memory_limit', '16M');

答案 1 :(得分:0)

Check your upload limit. The file might be larger than your php upload limit, causing the uploaded file to be non-existant.

In your php.ini modify the following variables

upload_max_filesize = 12M
post_max_size = 12M

You might have to increase memory_limit too, but I think it would be upload to be the main culprit here.

Turn on error reporting to see what errors are reported

error_reporting(E_ALL);