title: Codeigniter image compression not working
body: <p>I want to upload large images on my website. I want to reduce the size of those using codeigniter. So I am doing this code</p>
  
  <pre><code>function upload_image($data) {
      $config['upload_path'] = './temp/';
      $config['allowed_types'] = 'gif|jpg|png';
      $config['max_size'] = 10000;
      $this-&gt;load-&gt;library('upload', $config);
      if (!$this-&gt;upload-&gt;do_upload('image')) {
          $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
          pre($error);
      } else {
          $config = array();
          $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
          $config['image_library'] = 'gd';
          $config['source_image'] = './temp/' . $data['upload_data']['file_name'];
          $config['create_thumb'] = FALSE;
          $config['maintain_ratio'] = TRUE;
          $config['quality'] = 50;
          $config['new_image'] = './temp/' . $data['upload_data']['file_name'];
          $this-&gt;load-&gt;library('image_lib', $config);
          $this-&gt;image_lib-&gt;resize();
  
          pre($data);
      }
  }
  </code></pre>
  
  <p>But images are not being compressed. Original and uploaded size are the same. Where am I wrong?</p>