creating thumbnail in codeigniter

Solutions on MaxInterview for creating thumbnail in codeigniter by the best coders in the world

showing results for - "creating thumbnail in codeigniter"
Brook
14 Apr 2017
1public function do_resize()
2{
3    $filename = $this->input->post('new_val');
4    $source_path = $_SERVER['DOCUMENT_ROOT'] . '/uploads/avatar/tmp/' . $filename;
5    $target_path = $_SERVER['DOCUMENT_ROOT'] . '/uploads/avatar/';
6    $config_manip = array(
7        'image_library' => 'gd2',
8        'source_image' => $source_path,
9        'new_image' => $target_path,
10        'maintain_ratio' => TRUE,
11        'create_thumb' => TRUE,
12        'thumb_marker' => '_thumb',
13        'width' => 150,
14        'height' => 150
15    );
16    $this->load->library('image_lib', $config_manip);
17    if (!$this->image_lib->resize()) {
18        echo $this->image_lib->display_errors();
19    }
20    // clear //
21    $this->image_lib->clear();
22}
23