我已上传此图片:uploaded image
结果图片是:Watermark image
我的代码功能正常工作png类型图像和其他。只发生此图像..我找不到任何答案 相关的。请帮助任何人。这是我用来图像上传的代码。请检查一下并给出与此相关的任何答案
$this->watermark->watermarkCopy();
$this->watermark->resize($width, $height);
$this->watermark->add($temp_auction_listing['temp_auction_listing']['link_1'], $width, $height);
这是水印功能
public function watermarkCopy() {
$source = 'images/watermark/wartermark-png.png';
$watermarkcopy['image_library'] = 'gd2';
$watermarkcopy['source_image'] = $source;
$watermarkcopy['create_thumb'] = FALSE;
$watermarkcopy['maintain_ratio'] = TRUE;
$watermarkcopy['quality'] = '100%';
$watermarkcopy['new_image'] = 'images/watermark/watermarkCopy.png';
$watermarkcopy['overwrite'] = FALSE;
$this->load->library('image_lib');
$this->image_lib->initialize($watermarkcopy);
if (!$this->image_lib->resize()) {
echo $this->image_lib->display_errors();
}
}
public function resize($width, $height) {
$settings['maintain_ratio'] = TRUE;
$settings['image_library'] = 'gd2';
$settings['quality'] = '100%';
$settings['width'] = $width / 2;
$settings['height'] = $height / 2;
$settings['source_image'] = 'images/watermark/watermarkCopy.png';
$this->image_lib->initialize($settings);
$this->image_lib->resize();
}
public function add($url, $width, $height) {
ini_set('memory_limit', '128M');
$config['source_image'] = $url;
$config['wm_type'] = 'overlay';
$config['wm_overlay_path'] = 'images/watermark/watermarkCopy.png';
$config['new_image'] = $url;
$config['wm_hor_alignment'] = 'center';
$config['wm_vrt_alignment'] = 'middle';
$config['padding'] = '50%';
$config['wm_opacity'] = '50';
$config['wm_x_transp'] = '3';
$config['wm_y_transp'] = '3';
$config['quality'] = '100%';
$this->image_lib->initialize($config);
if (!$this->image_lib->watermark()) {
echo $this->image_lib->display_errors();
}
}