Welcome Guest, Not a member yet? Register   Sign In
$this->image_lib->resize() compress the file and reduce the file size
#1

[eluser]searain[/eluser]
Code:
//create largest dimension 480 px
        $config['image_library'] = 'gd2';
        $config['source_image'] = $data['upload_data']['full_path'];
        $config['create_thumb'] = FALSE;
        $config['maintain_ratio'] = TRUE;
        $config['width'] = 480;
        $config['height'] = 480;
$config['quality'] = 100;
      

        $this->image_lib->initialize($config);


        if (!$this->image_lib->resize()) {

            $error = $this->image_lib->display_errors();
            $this->session->set_flashdata('message',$error);
            return false;
        }

this script resizes image to 480x480. I have a image file 480x480, and the file size is 30K. After running this script, I got a new image file still 480x480, but the file size reduced to 8K or so. I have set up the quality to be 100.

this resize script is trying to resize file bigger than 480x480 to 480x480, but due to in the process, the file is compressed and the quality is not good. So I try to apply this script to a 480x480 source image to see how much file size it will be reduced.

My questions are

1) this is gd2 issue, right? the image was auto compressed?
2) anything I can do to keep the file size to be 50K, the graphic designer said the quality is not the same, when the file size turn from 50 K to 8K after the $this->image_lib->resize() was used.

Because we are trying to allow user upload the photo through CMS based on codeigniter, and resize the photos on the fly. But the resized photos quality is not good to satisfy the graphic designers so the end users sometimes.

Any help?




Theme © iAndrew 2016 - Forum software by © MyBB