Ich habe ein Bild mit der Dimension von (W-3000 X H-4000). Wenn ich es hochlade und die Größe verändere, wird es immer als Landscape-Modus angezeigt, meine neue Dimension ist w-1067 X h-800. Ich möchte dieses Bild entweder 800X600 für Querformat oder 600X800 für Hochformat erstellen. Hier ist mein Code:Codeigniter Bild drehen, wenn Bildgröße ändern
$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";
}
}
}
In meinem Code Höhe ist immer 800px groß. Es ist in Ordnung für 3000X4000 Dimensionsbild. Aber was ist, wenn ich 4000X3000 Dimension Image verwende? Kann mir jemand zu diesem Thema helfen? Dank
Verwendung getimagesize() – Vickel