我有一個尺寸爲(W-3000 X H-4000)的圖像。當我上傳並調整大小時,它總是顯示爲橫向模式,意味着新的尺寸是w-1067 X h-800。我想創建這張照片800X600的風景或600X800的肖像。這裏是我的代碼:圖像調整大小時,Codeigniter圖像旋轉
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'jpg|jpeg|gif|png';
$config['max_size'] = '5000';
$this->load->library('upload', $config);
//check if a file is being uploaded
if(strlen($_FILES["testimg"]["name"])>0){
if (!$this->upload->do_upload("testimg"))//Check if upload is unsuccessful
{
$error = array('error' => $this->upload->display_errors());
print_r($errors);
}
else
{
$config['image_library'] = 'gd2';
$config['source_image'] = $this->upload->upload_path.$this->upload->file_name;
$config['width'] = '1';
$config['height'] = '800';
$config['maintain_ratio'] = TRUE;
$config['master_dim'] = 'height';
$this->load->library('image_lib',$config);
if (!$this->image_lib->resize()){
echo "error";
}else{
echo "success";
}
}
}
在我的代碼高度總是800px的大小。 3000X4000尺寸圖像可以。但是,當我使用4000X3000尺寸圖像時呢?任何人都可以幫我解決這個問題嗎?由於
使用和getimagesize() – Vickel