title: How resize image and create thumbnail in codeigniter
body: <p>i have function to upload images in codeigniter, here i can upload any images, but when i need to show this images in my site i will use this code :-</p>
  
  <pre><code>&lt;img src="uploads/&lt;?=$user-&gt;pic?&gt;" width="250px" height="200px" /&gt;
  </code></pre>
  
  <p>if the image max than 250, the image not show good.</p>
  
  <p>So how can i do thumb for my pic.   </p>
  
  <pre><code>public function do_upload($field) {
      $config['upload_path'] = './uploads/';
      $config['allowed_types'] = 'gif|jpg|png';
      $config['max_size'] = '1000';
      $config['max_width'] = '1024';
      $config['max_height'] = '768';
  
      $this-&gt;load-&gt;library('upload', $config);
  
      if (!$this-&gt;upload-&gt;do_upload($field)) 
      {
          $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
          return $error;
      } 
      else
      {
        $updata =$this-&gt;upload-&gt;data();
        $data = $updata['raw_name'].$updata['file_ext'];
        return $data;
      }
  }
  </code></pre>