Posted By

pruntrut on 02/05/12


Tagged

php codeigniter


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Kurt


Upload and resize


 / Published in: PHP
 

  1. function do_upload() {
  2.  
  3. $config = array(
  4. 'allowed_types' => 'jpg|jpeg|gif|png',
  5. 'upload_path' => $this->gallery_path,
  6. 'max_size' => 2000
  7. );
  8.  
  9. $this->load->library('upload', $config);
  10. $this->upload->do_upload();
  11. $image_data = $this->upload->data();
  12.  
  13. $config = array(
  14. 'source_image' => $image_data['full_path'],
  15. 'new_image' => $this->gallery_path . '/thumbs',
  16. 'maintain_ration' => true,
  17. 'width' => 180,
  18. 'height' => 150
  19. );
  20.  
  21. $this->load->library('image_lib', $config);
  22. $this->image_lib->resize();
  23.  
  24. }
  25.  

Report this snippet  

You need to login to post a comment.