title: When 2 different images are uploaded to 2 different folders,then the images are uploaded.but the thumbs are not created
body: <p>Here is my controller function, please help me to create the thumbs of both images. Only the images are uploaded to the folder. i created a function named resize to create the thumbs. that's also given in the controller.</p>
  
  <pre><code>public function add() {
  
      $this-&gt;load-&gt;helper(array('form', 'url'));
      $this-&gt;load-&gt;helper('file');
      $this-&gt;load-&gt;library('form_validation');
  
  
      $this-&gt;form_validation-&gt;set_rules('txtPrdname', 'Product Name', 'trim|required|htmlspecialchars');
      $this-&gt;form_validation-&gt;set_rules('sbPrdcategory', 'Product Category', 'trim|required|htmlspecialchars');
      $this-&gt;form_validation-&gt;set_rules('sbPrduser', 'Managing User', 'trim|required|htmlspecialchars');
      $this-&gt;form_validation-&gt;set_rules('txtPrdprofile', 'Product Profile', 'trim|required|htmlspecialchars');
  
      if ($this-&gt;form_validation-&gt;run() == FALSE) {
  
          $data_view["error"] = "";
  
          $this-&gt;load-&gt;view('moderator/templates/header');
          $this-&gt;load-&gt;view('moderator/templates/sidebar');
          $this-&gt;load-&gt;view('moderator/b2bproduct_add', $data_view);
          $this-&gt;load-&gt;view('moderator/templates/footer');
  
      } else {
  
          // Image uploading codes
  
          $config['upload_path'] = 'assets/images/b2bproduct';
          $config['allowed_types'] = 'gif|jpg|jpeg|png';
          $config['max_size'] = '1000';
          $config['max_width'] = '2024';
          $config['max_height'] = '1768';
          $config['overwrite'] = TRUE;
          $config['remove_spaces'] = TRUE;
  
          if (isset($_FILES['filePrdimage']['name'])) {
              $config['file_name'] = substr(md5(time()), 0, 28) . $_FILES['filePrdimage']['name'];
          }
  
          $this-&gt;load-&gt;library('upload');
  
          $this-&gt;upload-&gt;initialize($config);
  
          if (!$this-&gt;upload-&gt;do_upload('filePrdimage')) {
  
              //no file uploaded or failed upload
  
              $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
  
          } else {
  
              $dat = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
  
              $this-&gt;load-&gt;library('upload');
              $this-&gt;upload-&gt;initialize($config);
              $this-&gt;resize($dat['upload_data']['full_path'], 'assets/images/b2bproduct/thump/' . $dat['upload_data']['file_name'], 180, 400);
          }
  
          if (empty($dat['upload_data']['file_name'])) {
              $prdimage = '';
          } else {
              $prdimage = $dat['upload_data']['file_name'];
          }    
  
          // End Image uploading Codes
          // Logo uploading codes
  
          $config['upload_path'] = 'assets/images/b2blogo';
          $config['allowed_types'] = 'gif|jpg|jpeg|png';
          $config['max_size'] = '1000';
          $config['max_width'] = '2024';
          $config['max_height'] = '1768';
          $config['overwrite'] = TRUE;
          $config['remove_spaces'] = TRUE;
  
          if (isset($_FILES['filePrdlogo']['name'])) {
              $config['file_name'] = substr(md5(time()), 0, 28) . $_FILES['filePrdlogo']['name'];
          }
  
          $this-&gt;load-&gt;library('upload');
  
          $this-&gt;upload-&gt;initialize($config);
  
          if (!$this-&gt;upload-&gt;do_upload('filePrdlogo')) {
  
              //no file uploaded or failed upload
  
              $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
  
          } else {
  
              $dat1 = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
  
              $this-&gt;load-&gt;library("upload",$config);
  
              $this-&gt;resize($dat1['upload_data']['full_path'], 'assets/images/b2blogo/thump/' . $dat1['upload_data']['file_name'], 180, 400);
          }
  
          if (empty($dat1['upload_data']['file_name'])) {
              $prdlogo = '';
          } else {
              $prdlogo = $dat1['upload_data']['file_name'];
          }
  
          // End Logo uploading Codes         
  
          $data = array(
              'prd_name' =&gt; $this-&gt;input-&gt;post('txtPrdname'),
              'prd_category' =&gt; $this-&gt;input-&gt;post('sbPrdcategory'),
              'prd_user' =&gt; $this-&gt;input-&gt;post('sbPrduser'),
              'prd_profile' =&gt; $this-&gt;input-&gt;post('txtPrdprofile'),
              'prd_oem' =&gt; $this-&gt;input-&gt;post('rbtnPrdoem'),
              'prd_protype' =&gt; $this-&gt;input-&gt;post('rbtnPrdprotype'),
              'prd_image' =&gt; $prdimage,
              'prd_ranktype' =&gt; $this-&gt;input-&gt;post('sbPrdranktype'),
              'prd_points' =&gt; $this-&gt;input-&gt;post('txtPrdpoints'),
              'prd_extrakey' =&gt; $this-&gt;input-&gt;post('txtPrdextrakey'),
              'prd_dated' =&gt; time(),
              'prd_ipadd' =&gt; $_SERVER['REMOTE_ADDR']
          );
  
          $result_id = $this-&gt;b2bproduct_model-&gt;add($data);
  
          if ($result_id) {
  
              redirect(base_url() . 'moderator/b2bproduct/view/' . $result_id, 'refresh');
  
          } else {
  
              $data_view["error"] = "Data can't insert due to database error";
  
              $this-&gt;load-&gt;view('moderator/templates/header');
  
              $this-&gt;load-&gt;view('moderator/templates/sidebar');
  
              $this-&gt;load-&gt;view('moderator/b2bproduct_add', $data_view);
  
              $this-&gt;load-&gt;view('moderator/templates/footer');
  
          }
  
      }
  
  }
  </code></pre>
  
  <p>Resize function</p>
  
  <pre><code>public function resize($source, $destination, $width, $height) {
      $config['image_library'] = 'gd2';
      $config['source_image'] = $source;
      $config['create_thumb'] = TRUE;
      $config['maintain_ratio'] = TRUE;
      $config['width'] = $width;
      $config['height'] = $height;
      $config['new_image'] = $destination;
      $this-&gt;load-&gt;library('image_lib', $config);
      $this-&gt;image_lib-&gt;resize();
  }
  </code></pre>