0
내 웹 사이트에 큰 이미지를 업로드하고 싶습니다. 나는 codeigniter를 사용하는 사람들의 크기를 줄이고 싶다. 따라서이 코드를 수행하고 있습니다.Codeigniter 이미지 압축이 작동하지 않습니다.
function upload_image($data) {
$config['upload_path'] = './temp/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 10000;
$this->load->library('upload', $config);
if (!$this->upload->do_upload('image')) {
$error = array('error' => $this->upload->display_errors());
pre($error);
} else {
$config = array();
$data = array('upload_data' => $this->upload->data());
$config['image_library'] = 'gd';
$config['source_image'] = './temp/' . $data['upload_data']['file_name'];
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = TRUE;
$config['quality'] = 50;
$config['new_image'] = './temp/' . $data['upload_data']['file_name'];
$this->load->library('image_lib', $config);
$this->image_lib->resize();
pre($data);
}
}
이미지가 압축되지 않습니다. 원본 및 업로드 된 크기는 동일합니다. 내가 어디서 잘못한거야?
사용 품질 PARAM이 매개 변수를 다음 이미지 $의 구성 [의 크기를 줄일 것 ' 너비 '] = 75; $ config [ 'height'] = 50; –