我正在使用 CI 上传库上传图像工作正常,水印和图像缩略图问题,如果 id 先水印然后缩略图,它对原始图像进行水印,但也重新调整缩略图大小但不保持原始大小的图像带水印同样,如果我先做缩略图然后给它加水印它工作正常,但我希望缩略图也加水印这是我的代码
$this->do_thumb('file_name');
$this->watermark('file_name');
function watermark($filename){
$image_cfg = array();
$image_cfg['image_library'] = 'GD2';
$image_cfg['source_image'] = 'upload/' . $filename;
$image_cfg['wm_overlay_path'] = 'upload/watermark.png';
$image_cfg['new_image'] = 'upload/mark_'.$filename;
$image_cfg['wm_type'] = 'overlay';
$image_cfg['wm_opacity'] = '10';
$image_cfg['wm_vrt_alignment'] = 'bottom';
$image_cfg['wm_hor_alignment'] = 'right';
$image_cfg['create_thumb'] = FALSE;
$this->image_lib->initialize($image_cfg);
$this->image_lib->watermark();
$this->image_lib->clear();
// echo $this->image_lib->display_errors();
// die();
}
function do_thumb($filename) {
$image_cfg['image_library'] = 'GD2';
$image_cfg['source_image'] = 'upload/' . $filename;
$image_cfg['create_thumb'] = TRUE;
$image_cfg['maintain_ratio'] = TRUE;
$image_cfg['width'] = '200';
$image_cfg['height'] = '175';
$this->load->library('image_lib');
$this->image_lib->initialize($image_cfg);
$this->image_lib->resize();
$this->image_lib->clear();
}