Welcome Guest, Not a member yet? Register   Sign In
Codeigniter image rotate when image resize
#1

I have an image with the dimension of (W-3000 X H-4000). When i upload it and resize, it always show like landscape mode, mean new dimension is w-1067 X h-800. I want to create this picture either 800X600 for landscape or 600X800 for portrait. Here is my code:



PHP Code:
$config['upload_path'] = './uploads/';
 
   $config['allowed_types'] = 'jpg|jpeg|gif|png';
   $config['max_size'] = '6048';
   $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'] = '600';
$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 my code height is always 800px in size. It is ok for 3000X4000 dimension image. But what about when i use 4000X3000 dimension image? Can any one help me about this issue? Thanks
Reply


Messages In This Thread
Codeigniter image rotate when image resize - by ashisbiswas - 04-15-2016, 09:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB