Get image height and width PHP

前端 未结 4 896
一整个雨季
一整个雨季 2020-12-30 07:32

Hello I need to get the height and width on the fly of an uploaded image.

This is the PHP function I am using, but it does not return anything for the width and heig

4条回答
  •  一生所求
    2020-12-30 08:19

    $DOCS_NAME = $_FILES['DOCS']['name'];
    $DOCS_SIZE = getimagesize($_FILES['DOCS']['tmp_name']);
    $DOCS      = file_get_contents ($_FILES['DOCS']['tmp_name']);
    $FILE_SIZE = $_FILES["DOCS"]["size"];
    $FILE_TYPE = $_FILES["DOCS"]["type"];
    
    echo 'Width     = '.$DOCS_SIZE[0]. "
    "; echo 'Height = '.$DOCS_SIZE[1]. "
    ";; echo '2 = '.$DOCS_SIZE[2]. "
    ";; echo '3 = '.$DOCS_SIZE[3]. "
    ";; echo 'bits = '.$DOCS_SIZE['bits']. "
    ";; echo 'channels = '.$DOCS_SIZE['channels']. "
    ";; echo 'mime = '.$DOCS_SIZE['mime']. "
    "; echo 'type = '.$_FILES["DOCS"]["type"]. "
    "; echo 'size = '.$_FILES["DOCS"]["size"]. "
    ";

提交回复
热议问题