title: how to resize image size(quality) with codeigniter image_lib
body: <p>we are creating an application which allows image upload, now we want to reduce the image size to reduce the page load time, now this is the code i'm using, it doesn't work, image size remains 100% it doesn't reduce, please help maybe i'm missing something or i'm doing something wrong</p>
  
  <pre><code>if(!empty($_FILES['image_field']['name']))
  {
      $config['upload_path'] = 'image_folder';
      $config['allowed_types'] = 'jpg|png';
      $config['max_size'] = '262144';
      $config['file_name'] = 'my_image_name';
      $this-&gt;load-&gt;library('upload',$config);
      if(!$this-&gt;upload-&gt;do_upload('image_field'))
      {
          $this-&gt;session-&gt;set_flashdata('error','&lt;div class="alert alert-warning"&gt;Something went wrong...try again...&lt;/div&gt;');
          redirect('Controller/function_name');
      }
      else
      {
          $type = array('image/png'=&gt;'png','image/jpg'=&gt;'jpg','image/jpeg'=&gt;'jpg');
          $config['image_library'] = 'gd2';
          $config['source_image'] = base_url().'image_folder'.$config['file_name'].'.'.$type[$_FILES['image_field']['type']];
          $config['quality'] = '50%';
          $this-&gt;load-&gt;library('image_lib', $config);
          $this-&gt;image_lib-&gt;resize();
          // save to database    
      }
  }
  </code></pre>
  
  <p>i'm using codeigniter 3.0</p>