标签:
插件下载:Drupal 7x,
说明:下载并解压
CKEditor4x插件:https://yunpan.cn/cxWVSmK2UNIad 访问密码 1784
IMCE:https://yunpan.cn/cxWju9L47cY6I 访问密码 4a72
路径:/sites/all/modules/
下载并解压
路径:/sites/all/modules/ckeditor/
地址:https://yunpan.cn/cxWjiSsaDFFPe 访问密码 5e98
打开 信息面板 – 配置 - ckeditor
选择本地ckeditor路径,不要使用cdn加速
路径:/sites/all/modules/ckeditor/plugins/
路径:sites/all/
说明:为当前主题的template.php文件添加头文件及初始化代码
路径:sites/all/WordPaster/upload.php
代码如下:
<?php
ob_start();
//201201/10
$timeDir = date("Ym")."/".date("d");
$uploadDir = dirname(__FILE__).‘../../../default/files/field/image/‘.$timeDir;
$curDomain = "http://".$_SERVER["HTTP_HOST"]."/drupal/";
//相对路径 http://www.ncmem.com/upload/2012-1-10/
$relatPath = $curDomain ."sites/default/files/field/image/" . $timeDir . "/";
//自动创建目录。upload/2012-1-10
if(!is_dir($uploadDir))
{
mkdir($uploadDir,0777,true);
}
//如果PHP页面为UTF-8编码,请使用urldecode解码文件名称
//$fileName = urldecode($_FILES[‘postedFile‘][‘name‘]);
//如果PHP页面为GB2312编码,则可直接读取文件名称
$fileName = $_FILES[‘file‘][‘name‘];
$tmpName = $_FILES[‘file‘][‘tmp_name‘];
//取文件扩展名jpg,gif,bmp,png
$path_parts = pathinfo($fileName);
$ext = $path_parts["extension"];
$ext = strtolower($ext);//jpg,png,gif,bmp
//只允许上传图片类型的文件
if($ext == "jpg"
|| $ext == "jpeg"
|| $ext == "png"
|| $ext == "gif"
|| $ext == "bmp")
{
//年_月_日_时分秒毫秒.jpg
$saveFileName = $fileName;
//xxx/2011_05_05_091250000.jpg
$savePath = $uploadDir . "/" . $saveFileName;
//另存为新文件名称
if (!move_uploaded_file($tmpName,$savePath))
{
exit(‘upload error!‘ . "文件名称:" .$fileName . "保存路径:" . $savePath);
}
}
//输出图片路径
//$_SERVER[‘HTTP_HOST‘] localhost:81
//$_SERVER[‘REQUEST_URI‘] /FCKEditor2.4.6.1/php/test.php
$reqPath = str_replace("upload.php","",$_SERVER[‘REQUEST_URI‘]);
echo $relatPath . $saveFileName;
header(‘Content-type: text/html; charset=utf-8‘);
header(‘Content-Length: ‘ . ob_get_length());
?>
修改域名及文件存储路径
图片存储结构
WordPaster-Drupal 7.34-CKEditor4x
标签:
原文地址:http://www.cnblogs.com/xproer/p/5206493.html