<?php
include('../../../../../core/library/uploadimg.lib.php');
include('../../../../../core/config/water.cfg.php');//上传配置
$config = array(
"uploadPath"=>"../../../../../data/ueditor/", //保存路径
"fileType"=>array(".gif",".png",".jpg",".jpeg",".bmp"), //文件允许格式
"fileSize"=>1000 //文件大小限制,单位KB
);
//文件上传状态,当成功时返回SUCCESS,其余值将直接返回对应字符窜并显示在图片预览框,同时可以在前端页面通过回调函数获取对应字符窜
$state = "SUCCESS";$fileName=""; $title = htmlspecialchars($_POST['pictitle'], ENT_QUOTES);
$path = $config['uploadPath'];
if(!file_exists($path)){
mkdir("$path", 0777);
}
//格式验证
$current_type = strtolower(strrchr($_FILES["picdata"]["name"], '.'));
if(!in_array($current_type, $config['fileType'])){
$state = "不支持的图片类型!";
}
//大小验证
$file_size = 1024 * $config['fileSize'];
if( $_FILES["picdata"]["size"] > $file_size ){
$state = "图片大小超出限制!";
}
//保存图片
if($state == "SUCCESS"){
$tmp_file=$_FILES["picdata"]["name"];
$fileName = $path.rand(1,10000).time().strrchr($tmp_file,'.');
$result = move_uploaded_file($_FILES["picdata"]["tmp_name"],$fileName);
if(!$result){
$state = "图片保存失败!";
}
}
//向浏览器返回数据json数据
$file= str_replace('../','',$fileName); //为方便理解,替换掉所有类似../和./等相对路径标识
//setWater($file,"/data/upload/2013/09/1379497220_4534.png",9,"img");
imageWaterMark($file, $waterImage = "", $waterText = "", $textFont = 3, $textColor = "#FFFFFF")
echo "{'url':'" .$file." ', 'title':'".$title."','state':'".$state."'}";
//setWater("$file","images/sy.png",0,"img");
//imageWaterMark($file,$isWaterImage,);
//seWater(原图,水印,位置0-9,字体,图片水印或文字水印)
?>这个页面的51行imageWaterMark就是我引用的uploadimg.lib.php这个页面的加水印的类.
现在我在后台编辑器里面上传图片.连回显都不回显了
include('../../../../../core/library/uploadimg.lib.php');
include('../../../../../core/config/water.cfg.php');//上传配置
$config = array(
"uploadPath"=>"../../../../../data/ueditor/", //保存路径
"fileType"=>array(".gif",".png",".jpg",".jpeg",".bmp"), //文件允许格式
"fileSize"=>1000 //文件大小限制,单位KB
);
//文件上传状态,当成功时返回SUCCESS,其余值将直接返回对应字符窜并显示在图片预览框,同时可以在前端页面通过回调函数获取对应字符窜
$state = "SUCCESS";$fileName=""; $title = htmlspecialchars($_POST['pictitle'], ENT_QUOTES);
$path = $config['uploadPath'];
if(!file_exists($path)){
mkdir("$path", 0777);
}
//格式验证
$current_type = strtolower(strrchr($_FILES["picdata"]["name"], '.'));
if(!in_array($current_type, $config['fileType'])){
$state = "不支持的图片类型!";
}
//大小验证
$file_size = 1024 * $config['fileSize'];
if( $_FILES["picdata"]["size"] > $file_size ){
$state = "图片大小超出限制!";
}
//保存图片
if($state == "SUCCESS"){
$tmp_file=$_FILES["picdata"]["name"];
$fileName = $path.rand(1,10000).time().strrchr($tmp_file,'.');
$result = move_uploaded_file($_FILES["picdata"]["tmp_name"],$fileName);
if(!$result){
$state = "图片保存失败!";
}
}
//向浏览器返回数据json数据
$file= str_replace('../','',$fileName); //为方便理解,替换掉所有类似../和./等相对路径标识
//setWater($file,"/data/upload/2013/09/1379497220_4534.png",9,"img");
imageWaterMark($file, $waterImage = "", $waterText = "", $textFont = 3, $textColor = "#FFFFFF")
echo "{'url':'" .$file." ', 'title':'".$title."','state':'".$state."'}";
//setWater("$file","images/sy.png",0,"img");
//imageWaterMark($file,$isWaterImage,);
//seWater(原图,水印,位置0-9,字体,图片水印或文字水印)
?>这个页面的51行imageWaterMark就是我引用的uploadimg.lib.php这个页面的加水印的类.
现在我在后台编辑器里面上传图片.连回显都不回显了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货