2016-04-26 17 views
1
$config['image_library'] = 'gd2'; 
    $config['quality']  = '99'; 
    $config['source_image'] = $img_path; 
    $config['create_thumb'] = TRUE; 
    $config['maintain_ratio'] =TRUE; 
    $config['width'] = 300; 
    $config['height'] = 220; 
    $config['new_image']='uploads/'. $this->upload->data('file'); 
    $this->image_lib->initialize($config); 
    $this->image_lib->resize(); 

にリサイズし、私はcodeignterでimage_libraryを使用していますが、それらは、画像の品質を取得する方法があり、低品質の画像を生成しています。 これはサイズ変更後の出力です。高品質な画像を取得する方法は、後にCodeIgniterの

enter image description here

+0

に役立ちますあなたはCIの完全な知識を持っているのですか? –

+0

はい私は助けてください助けてください – Gnziet

答えて

0

希望これは

function uploadimage() 
{ 

     $image_upload_folder='**upload folder path**'; 
     $this->upload_config = array(
        'upload_path' => $image_upload_folder, 
        'allowed_types' => 'png|jpg|jpeg|gif|GIF|PNG|JPEG|Jpeg|JPG', 
        'remove_space' => TRUE, 
        'encrypt_name' => TRUE, 
      ); 

     $this->load->library('upload'); 
     $this->upload->initialize($this->upload_config); 

     if (! $this->upload->do_upload('image')){ 
       return $group_image = ''; 
     } 
     else{ 
       $data = $this->upload->data(); 

       $this->gallery_path = realpath(APPPATH . '../uploads');//fetching path 

       $config1 = array(
         'source_image' => $data['full_path'], //get original image 
         'new_image' => $this->gallery_path.'/**thumb image path**', //save as new image //need to create thumbs first 
         'maintain_ratio' => true, 
         'width' => 600, 
         'height' => 600 

        ); 
      $this->load->library('image_lib', $config1); //load library 
      $this->image_lib->resize(); //generating thumb 

      return $group_image = $data['file_name']; 
      } 
} 
+0

上記の機能を使用してチェックし、私に教えてください –

関連する問題