嗨,我在codeigniter 3.0上上传时遇到问题。
图像保存为黑色背景。为什么?
代码:
$this->load->library('upload', $config);
if ($this->upload->do_upload("immagine")) :
$this->load->library("image_lib");
$file = $this->upload->data();
$nome_file_originale = $file["file_name"];
$config = array();
$config['source_image'] = "../public/offerte/".$nome_file_originale;
//ImageJPEG(ImageCreateFromString(file_get_contents($config['source_image'])), $config['source_image'], 70);
// thumb
$config['imagealphablending'] = TRUE;
$config['imagesavealpha'] = TRUE;
$config['create_thumb'] = TRUE;
$config['thumb_marker'] = '__thumbnail';
$config['maintain_ratio'] = FALSE;
$config['width'] = 400;
$config['height'] = 256;
$this->image_lib->initialize($config);
$data["immagine_th"] = $this->image_lib->resize();
$this->image_lib->clear();
// large
$config['imagealphablending'] = TRUE;
$config['imagesavealpha'] = TRUE;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = FALSE;
$config['width'] = 800;
$config['height'] = 800;
$this->image_lib->initialize($config);
$data["immagine_zoom"] = $this->image_lib->resize();
$this->image_lib->clear();
endif;
我不明白为什么会这样。 请帮助我