网站的图片拿用户名做水印怎么实现?

我的这段代码是以 目标路径的图片作为水印的,怎么改成上传者的用户名作为水印?用户名标签是 ['attach_name']

if ($upload_data['is_image'] == 1)
        {
            foreach (AWS_APP::config()->get('image')->attachment_thumbnail AS $key => $val)
            {
                $thumb_file[$key] = $upload_data['file_path'] . $val['w'] . 'x' . $val['h'] . '_' . basename($upload_data['full_path']);
                if(H::isAnimatedGif($upload_data['full_path'])==0){
                    $wwater_info = getimagesize($upload_data['full_path']);
                    $wwater_w = $wwater_info[0];//取得水印图片的宽
                    $wwater_h = $wwater_info[1];//取得水印图片的高
                    if(FOX_water=='on' && ($wwater_w>=FOX_water_w && $wwater_h>=FOX_water_h)){
                        $waterImage=$_SERVER['DOCUMENT_ROOT']."/static/water.png";//水印图片路径
                        H::FoximageWaterMark($upload_data['full_path'],9,$waterImage);
                    }
                }
                AWS_APP::image()->initialize(array(
                    'quality' => 90,
                    'source_image' => $upload_data['full_path'],
                    'new_image' => $thumb_file[$key],
                    'width' => $val['w'],
                    'height' => $val['h']
                ))->resize();
            }
        }
阅读 2.5k
1 个回答

用户名先生成图片然后合并上去,是一样的道理啊。或者你可以把两个库合并一下,直接取用户名生成图片然后合并成水印,这样就不用保存用户名了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进