1, can be resolved through the front, in this case resolved by the back-end
Analyzing browser request ua, if ios browser 90 degree rotation is performed
public function upload() { $file = $this->request->file('file'); if (empty($file)) { $this->error(__('No file upload or server upload limit exceeded')); } // determine the type of browser if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){ try{ $exif = @exif_read_data($_FILES['file']['tmp_name']); $image = imagecreatefromstring(file_get_contents($_FILES['file']['tmp_name'])); //Rotate 90 degrees $image = imagerotate($image, -90, 0); imagejpeg($image, $_FILES['file']['tmp_name']); imagedestroy($image); }catch(\Exception $e){ //echo $e->getMessage(); } }