How can I use getimagesize() with $_FILES['']?

后端 未结 4 1373
清歌不尽
清歌不尽 2021-02-14 11:17

I am doing an image upload handler and I would like it to detect the dimensions of the image that\'s been uploaded by the user.

So I start with:

if (isse         


        
4条回答
  •  你的背包
    2021-02-14 12:03

    Try this for multi images :

    for($i=0; $i < count($filenames); $i++){  
    
        $image_info = getimagesize($images['tmp_name'][$i]);
        $image_width  = $image_info[0];
        $image_height = $image_info[1];
    }
    

    Try this for single image :

    $image_info = getimagesize($images['tmp_name']);
    $image_width  = $image_info[0];
    $image_height = $image_info[1];
    

    at least it works for me.

提交回复
热议问题