How to restrict image width or height on upload

后端 未结 3 1065
一生所求
一生所求 2021-01-16 05:03

I would like manipulate/resize images in a similar way to Pinterest but I am not sure what is the best way to approach it. The goal is to allow a mix of both portrait and la

3条回答
  •  北恋
    北恋 (楼主)
    2021-01-16 05:59

    try with this

           $needheight = 1000;
           $needwidth = 1000;
    
           $arrtest = getimagesize($upload_image_physical_path);
    
            $actualwidth = $arrtest[0];
            $actualheight = $arrtest[1];
    
            if($needwidth > $actualwidth || $needheight > $actualheight){
                 //uplaod code  
            }
    

    cheers

提交回复
热议问题