title: Codeigniter - Upload image, generate thumbnail, save both directories in database
body: <p>This is my model:</p>
  
  <p>I am getting the following error</p>
  
  <pre><code> Fatal error: Call to undefined method CI_Image_lib::data() in C:\xampp\htdocs\adcc\application\models\media_model.php on line 58
  </code></pre>
  
  <p><strong>My question:</strong> Why can't I use data() to get the ['full_path'] from the saved thumbnail (like I did for upload)? </p>
  
  <p>Is there a better way to do this? Thanks!</p>
  
  <pre><code>public function set_media() {
  
          $config1 = array(
              'allowed_types' =&gt; 'jpg|jpeg|gif|png',
              'upload_path' =&gt; $this-&gt;gallery_path . '/images',
              'max_size' =&gt; 2048
          );
  
          $this-&gt;load-&gt;library('upload');
          $this-&gt;upload-&gt;initialize($config1);
          $this-&gt;upload-&gt;do_upload();
  
          $image_data = $this-&gt;upload-&gt;data();
  
          $config2 = array(
              'source_image' =&gt; $image_data['full_path'],
              'new_image' =&gt; $this-&gt;gallery_path . '/thumbs',
              'maintain_ratio' =&gt; true,
              'width' =&gt; 150,
              'height' =&gt; 100
          );
  
          $this-&gt;load-&gt;library('image_lib', $config2);
          $this-&gt;image_lib-&gt;resize();
          $image_data2 = $this-&gt;image_lib-&gt;data();
  
          $this-&gt;load-&gt;helper('url');
  
          $id = url_title($this-&gt;input-&gt;post('title'), 'dash', TRUE);
  
          $data = array(
              'id' =&gt; $id,
              'name' =&gt; $this-&gt;input-&gt;post('name'),
              'link' =&gt; $this-&gt;input-&gt;post('link'),
              'year' =&gt; $this-&gt;input-&gt;post('year'),
              'actors' =&gt; $this-&gt;input-&gt;post('actors'),
              'image' =&gt; $image_data['full_path'],
              'thumb' =&gt; $image_data2['full_path']
          );
  
          return $this-&gt;mongo_db-&gt;insert('media', $data);
      }
  </code></pre>