我有一个尺寸为(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