title: Multiple Image Resizes at once in Codeigniter , won't work
body: <p>I am trying to upload images and re-size them in different dimensions within the same function. but what happens is that only one re-size works and the others don't . My code is:</p>
  
  <pre><code>    function do_upload()
  {
      $this_user = $this-&gt;auth-&gt;info;if(!is_dir('./uploads/'.$this_user-&gt;username)){
          mkdir('./uploads/'.$this_user-&gt;username);
          mkdir('./uploads/'.$this_user-&gt;username.'/photos');
          mkdir('./uploads/'.$this_user-&gt;username.'/photos/master');
          mkdir('./uploads/'.$this_user-&gt;username.'/photos/small');
          mkdir('./uploads/'.$this_user-&gt;username.'/photos/medium');
          mkdir('./uploads/'.$this_user-&gt;username.'/photos/large');
          mkdir('./uploads/'.$this_user-&gt;username.'/photos/xlarge');
      }
      $config['upload_path'] = './uploads/'.$this_user-&gt;username.'/photos/master/';
      $config['allowed_types'] = 'gif|jpg';
  
      $title = $this-&gt;input-&gt;post('title');
      $this-&gt;load-&gt;library('upload', $config);
      if ( ! $this-&gt;upload-&gt;do_upload())
      {
          echo '&lt;div id="status"&gt;error&lt;/div&gt;';
          echo '&lt;div id="message"&gt;'. $this-&gt;upload-&gt;display_errors() .'&lt;/div&gt;';
      }
      else
      {
          $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
          //resizing begins
              $image_width = $data['upload_data']['image_width'];
              $image_height = $data['upload_data']['image_height'];
              $full_path = $data['upload_data']['full_path'];
              //checking for width
              if($image_width&gt;5000){
                  $config['image_library'] = 'gd2';
                  $config['source_image'] = $full_path;
                  //$config['create_thumb'] = TRUE;
                  $config['maintain_ratio'] = TRUE;
                  $config['width'] = 5000;
                  //$config['height'] = 50;
                  $config['new_image'] = './uploads/'.$this_user-&gt;username.'/photos/xlarge';
                  $this-&gt;load-&gt;library('image_lib', $config);
                  $this-&gt;image_lib-&gt;resize();
              }
              if($image_width&gt;=4500){
                  $config['image_library'] = 'gd2';
                  $config['source_image'] = $full_path;
                  //$config['create_thumb'] = TRUE;
                  $config['maintain_ratio'] = TRUE;
                  $config['width'] = 4500;
                  //$config['height'] = 50;
                  $config['new_image'] = './uploads/'.$this_user-&gt;username.'/photos/large';
                  $this-&gt;load-&gt;library('image_lib', $config);
                  $this-&gt;image_lib-&gt;resize();
              }
              if($image_width&gt;=2000){
                  $config['image_library'] = 'gd2';
                  $config['source_image'] = $full_path;
                  //$config['create_thumb'] = TRUE;
                  $config['maintain_ratio'] = TRUE;
                  $config['width'] = 2000;
                  //$config['height'] = 50;
                  $config['new_image'] = './uploads/'.$this_user-&gt;username.'/photos/medium';
                  $this-&gt;load-&gt;library('image_lib', $config);
                  $this-&gt;image_lib-&gt;resize();
              }
              if($image_width&gt;=800){
                  $config['image_library'] = 'gd2';
                  $config['source_image'] = $full_path;
                  //$config['create_thumb'] = TRUE;
                  $config['maintain_ratio'] = TRUE;
                  $config['width'] = 800;
                  //$config['height'] = 50;
                  $config['new_image'] = './uploads/'.$this_user-&gt;username.'/photos/small';
                  $this-&gt;load-&gt;library('image_lib', $config);
                  $this-&gt;image_lib-&gt;resize();
              }
          //resizing ends
          echo '&lt;div id="status"&gt;success&lt;/div&gt;';
          //then output your message (optional)
          echo '&lt;div id="message"&gt;'. $data['upload_data']['file_name'].$this-&gt;input-&gt;post('type').' Successfully uploaded.&lt;/div&gt;';
          //pass the data to js
          echo '&lt;div id="upload_data"&gt;'. json_encode($data) . '&lt;/div&gt;';
  
      }
  }
  </code></pre>
  
  <p>What Am I doing wrong here?</p>