title: How can I convert BASE64 to Image in Codeigniter?
body: <p>Codeigniter Code:</p>
  
  <pre><code>$filedata = explode(',', $this-&gt;input-&gt;post('lostimage1'));
  $pos  = strpos($this-&gt;input-&gt;post('lostimage1'), ';');
  $type = explode(':', substr($this-&gt;input-&gt;post('lostimage1'), 0, $pos))[1];
  $type = '.'.$type;
  $type = str_replace('image/', '', $type);
  $img1 = $img['img'].''.$type;
  write_file('./uploads/'.$data['pet_hidenum'].'/'.$img1, $filedata[1]);
  </code></pre>
  
  <p>My code is working fine. when I am downloading the image from the server and opening it image in paint or chrome then it displaying error invalid bitmap How can I resolve this error?</p>