Answers for "creating thumbnail in codeigniter"

PHP
0

creating thumbnail in codeigniter

public function do_resize()
{
    $filename = $this->input->post('new_val');
    $source_path = $_SERVER['DOCUMENT_ROOT'] . '/uploads/avatar/tmp/' . $filename;
    $target_path = $_SERVER['DOCUMENT_ROOT'] . '/uploads/avatar/';
    $config_manip = array(
        'image_library' => 'gd2',
        'source_image' => $source_path,
        'new_image' => $target_path,
        'maintain_ratio' => TRUE,
        'create_thumb' => TRUE,
        'thumb_marker' => '_thumb',
        'width' => 150,
        'height' => 150
    );
    $this->load->library('image_lib', $config_manip);
    if (!$this->image_lib->resize()) {
        echo $this->image_lib->display_errors();
    }
    // clear //
    $this->image_lib->clear();
}
Posted by: Guest on October-31-2020

Browse Popular Code Answers by Language