织梦使用kindeditor后批量上传图片无法加水印,解决方法是修改/include/dialog/kindeditor_post.php文件,用以下代码进行替换即可解决
具体代码如下:
encode(array('error'=>1,'message'=>$msg));exit;}$ext_arr=array('image'=>array('gif','jpg','jpeg','png','bmp'),'flash'=>array('swf','flv'),'media'=>array('swf','flv','mp3','wav','wma','wmv','mid','avi','mpg','asf','rm','rmvb'),'file'=>array('doc','docx','xls','xlsx','ppt','htm','html','txt','zip','rar','gz','bz2','pdf'),);$media_type=array('image'=>1,'flash'=>2,'media'=>3,'file'=>4,);if(empty($activepath)){$activepath='';$activepath=str_replace('.','',$activepath);$activepath=preg_replace("#\/{1,}#",'/',$activepath);if(strlen($activepath)getUserID().'-'.dd2char(MyDate("ymdHis",$nowtme).mt_rand(100,999));$filename=$mdir.'/'.$filename_name;$fs=explode('.',$imgfile_name);$filename=$filename.'.'.$fs[count($fs)-1];$filename_name=$filename_name.'.'.$fs[count($fs)-1];$fullfilename=$cfg_basedir.$activepath."/".$filename;move_uploaded_file($imgFile,$fullfilename)ordie("上传文件到$fullfilename失败!");//远程同步到附件服务器if($cfg_multiserv['rmmedia']==1){if(!$ftp->_is_conn())$ftp->connect($cfg_multiserv);//分析远程文件路径$remotefile=str_replace(DEDEROOT,'',$fullfilename);$localfile='../..'.$remotefile;//创建远程文件夹$remotedir=preg_replace('/[^\/]*\.(jpg|gif|bmp|png)/','',$remotefile);$ftp->rmkdir($remotedir);$ftp->upload($localfile,$remotefile);}@unlink($imgfile);if(empty($resize)){$resize=0;}if($resize==1){if(in_array($imgfile_type,$cfg_photo_typenames)){ImageResize($fullfilename,$iwidth,$iheight);}}else{if(in_array($imgfile_type,$cfg_photo_typenames)){if($ismarkup==1)WaterImg($fullfilename,'up');}}$info='';$sizes[0]=0;$sizes[1]=0;if($dir_name=='image'){$sizes=getimagesize($fullfilename,$info);}$imgwidthValue=$sizes[0];$imgheightValue=$sizes[1];$imgsize=filesize($fullfilename);$media_type=$media_type[$dir_name];//批量上传水印if($photo_markup==1)WaterImg($fullfilename,'up');//WaterImg($fullfilename,'up');$inquery="INSERTINTO`dede_uploads`(arcid,title,url,mediatype,width,height,playtime,filesize,uptime,mid)VALUES('0','$filename','".$activepath."/".$filename."','{$media_type}','$imgwidthValue','$imgheightValue','0','{$imgsize}','{$nowtme}','".$cuserLogin->getUserID()."');";$dsql->ExecuteNoneQuery($inquery);$fid=$dsql->GetLastID();AddMyAddon($fid,$activepath.'/'.$filename);$CKUpload=isset($CKUpload)?$CKUpload:FALSE;$json=newServices_JSON();echo$json->encode(array('error'=>0,'url'=>$activepath."/$mdir/".$filename_name));exit();