织梦整合七牛云全部文件打包(gbk / utf8),见文章底部,由于改动文件较多,打包文件仅适合网站未二次修改过同学使用;二次修改过程序的同学请用【Beyond Compare】软件对比来修改;警告:使用前请务必先备份以下需要改动的文件
改动文件包括以下:/dede/album_add.php/dede/album_edit.php/dede/config.php/dede/imagecut.php/dede/swfupload.php/dede/inc/inc_archives_all.php/dede/inc/inc_archives_functions.php/dede/templets/imagecut.htm/include/customfields.func.php/include/dialog/select_images.php/include/dialog/select_images_post.php/include/dialog/select_media.php/include/dialog/select_soft.php/include/dialog/select_soft_post.php/include/helpers/upload.helper.php添加文件夹有/include/qiniu环境要求PHP >= 5.3.0cURL 扩展织梦整合七牛云特点1、支持缩略图本地上传、站内选择上传、支持原图选择、支持裁切选择、支持勾选远程下载2、支持多媒体、附件上传3、支持自定义字段(图片、多媒体、附件)4、支持图集[上传][编辑][删除]5、支持织梦自带编辑器ckeditor单图片、多图片、多媒体、附件上传6、支持文章内容[下载远程图片和资源]如果是你的七牛云空间图片不会再自动下载,其他远程附件正常下载并上传到七牛云7、支持开启和关闭七牛云
使用前设置申请七牛云,开通存储,域名那些简单操作这里不再唠叨。后台 - 系统配置 - 添加变量(注意对比,一个也不能错)
变量名称:cfg_qiniu变量类型:布尔(Y/N)参数说明:开启七牛云变量值:Y所属组:站点设置复制12345;变量名称:cfg_qiniubucket变量类型:文本参数说明:七牛云空间变量值:所属组:站点设置复制12345;变量名称:cfg_qiniudomain变量类型:文本参数说明:七牛云域名变量值:所属组:站点设置复制12345;变量名称:cfg_qiniuak变量类型:文本参数说明:七牛云AK变量值:所属组:站点设置复制12345;变量名称:cfg_qiniusk变量类型:文本参数说明:七牛云SK变量值:所属组:站点设置复制12345
kindeditor支持七牛云上传教程;打开 /include/dialog/kindeditor_post.php 找到$inquery = "INSERT INT在它的上面加入//开启七牛云require_once(DEDEINC.'/qiniu/autoload.php');use QiniuAuth;$auth = new Auth($cfg_qiniuak, $cfg_qiniusk);$token = $auth->uploadToken($cfg_qiniubucket);use QiniuStorageUploadManager;if($cfg_qiniu == 'Y'){$uploadMgr = new UploadManager();$key = substr($activepath,1).'/'.$filename;list($ret, $err) = $uploadMgr->putFile($token, $key, $fullfilename);}继续找到'".$activepath."/".$filename."'改成'".$cfg_qiniudomain.$activepath."/".$filename."'最后找到$activepath."/$mdir/".$filename_name改成$cfg_qiniudomain.$activepath."/$mdir/".$filename_name完成。
ueditor支持七牛云上传教程。打开 /include/ueditor/php/Uploader.class.php 找到classUploader复制1在它的上面加入require_once("../../common.inc.php");require_once("../../image.func.php");//开启七牛云require_once(DEDEINC.'/qiniu/autoload.php');use QiniuAuth;use QiniuStorageUploadManager;继续找到/** * 获取当前上传成功文件的各项信息 * @return array */public function getFileInfo(){return array("state" => $this->stateInfo,"url" => $this->fullName,"title" => $this->fileName,"original" => $this->oriName,"type" => $this->fileType,"size" => $this->fileSize);}在这个方法的下面加入一个方法/*** 七牛云上传* @param $key文件的名称* @param $filePath上传的文件*/public function QiniuUpload($key, $filePath){global $cfg_qiniu, $cfg_qiniuak, $cfg_qiniusk, $cfg_qiniubucket, $cfg_qiniudomain;$auth = new Auth($cfg_qiniuak, $cfg_qiniusk);$token = $auth->uploadToken($cfg_qiniubucket);$uploadMgr = new UploadManager();list($ret, $err) = $uploadMgr->putFile($token, $key, $filePath);if($err !== null){$err['status'] = 0;return $err;}else{$ret['status'] = 1;return $ret;}}
最后找到$this->stateInfo = $this->stateMap[0];这个地方有3处,都要在找到的代码下面添加//开启七牛云global $cfg_qiniu, $cfg_qiniudomain;if($cfg_qiniu == 'Y'){$ret = $this->QiniuUpload(preg_replace('///','',$this->fullName,1), $this->filePath);if($ret['status'] == 1){$this->fullName = $cfg_qiniudomain.$this->fullName;}}完成。
织梦自带采集支持上传附件到七牛云教程。打开/include/dedecollection.class.php找到@set_time_limit(0);在它的下面加入//开启七牛云require_once(DEDEINC.'/qiniu/autoload.php');use QiniuAuth;use QiniuStorageUploadManager;继续找到global $notckpic;在它的下面加入global $cfg_qiniu, $cfg_qiniuak, $cfg_qiniusk, $cfg_qiniubucket, $cfg_qiniudomain;继续找到if($tofile=='')它的上面加入//开启七牛云if($cfg_qiniu == 'Y'){$auth = new Auth($cfg_qiniuak, $cfg_qiniusk);$token = $auth->uploadToken($cfg_qiniubucket);$uploadMgr = new UploadManager();$key = preg_replace('///','',$filename,1);list($ret, $err) = $uploadMgr->putFile($token, $key, $GLOBALS['cfg_basedir'].$filename);}最后找到return $filename;改成//开启七牛云if($cfg_qiniu == 'Y'){$auth = new Auth($cfg_qiniuak, $cfg_qiniusk);$token = $auth->uploadToken($cfg_qiniubucket);$uploadMgr = new UploadManager();$key = preg_replace('///','',$filename,1);list($ret, $err) = $uploadMgr->putFile($token, $key, $GLOBALS['cfg_basedir'].$filename);}return $cfg_qiniudomain.$filename;