1.打开 e/class/connect.php
找到
if(!defined('EmpireCMSConfig'))
{
exit();
}
在下面增加
//阿里云上传
require_once(ECMS_PATH.'e/ecmsshop/aliyunoss/autoload.php');
use OSS\OssClient;
use OSS\Core\OssException;
function aliup($filename,$img){
global $accessKeyId,$accessKeySecret,$endpoint,$bucket;
$object = $filename;
$content = $img;
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint);
$content = $ossClient->putObject($bucket, $object, $content);
return "";
}
//阿里云上传结束
继续找到
function DoTranFile($file,$file_name,$file_type,$file_size,$classid,$ecms=0){
找到
global $public_r,$class_r,$doetran,$efileftp_fr;
替换为
global $public_r,$class_r,$doetran,$efileftp_fr,$endpoint,$bucket,$alihttp;
继续在下面找到
//FileServer
if($public_r['openfileserver'])
{
$efileftp_fr[]=$r['yname'];
}
return $r;
在上面增加
//开始存储到阿里云oss
$uri = $r["url"];
if (file_exists($_SERVER["DOCUMENT_ROOT"].$uri)) {
$string=ReadFiletext($_SERVER["DOCUMENT_ROOT"].$uri);
$alfile=$fspath['filepath'].$filepath.$r[filename];
aliup($alfile,$string);
if($alihttp){
$r[url]=$alihttp.$r[url];
} else {
$r[url]="http://".$bucket.".".$endpoint.$r[url];
}
}
然后继续查找
//远程保存
function DoTranUrl($url,$classid){
把下面一行的
global $public_r,$class_r,$ecms_config,$efileftp_fr;
替换为
global $public_r,$class_r,$ecms_config,$efileftp_fr,$endpoint,$bucket,$alihttp;
继续找到
$r[yname]=$r[savepath].$r[filename];
在下面增加
$alfile=$fspath['filepath'].$filepath.$r[filename];
aliup($alfile,$string);
if($alihttp){
$r[url]=$alihttp.$r[url];
} else {
$r[url]="http://".$bucket.".".$endpoint.$r[url];
}
然后找到
WriteFiletext_n($r[yname],$string);
修改为
//WriteFiletext_n($r[yname],$string);
2.打开/e/admin/ecmseditor/fileinc/editorpic.php
找到
if(!defined('InEmpireCMS'))
{
exit();
}
在下面加
require_once(ECMS_PATH.'e/ecmsshop/aliyunoss/config.php');
继续找到
$file=$fspath['fileurl'].$filepath.$r[filename];
修改为
if($alihttp){
$file=$alihttp.$fspath['fileurl'].$filepath.$r[filename];
} else {
$file="http://".$bucket.".".$endpoint.$fspath['fileurl'].$filepath.$r[filename];
}
3.继续打开 e/class/functions.php
在<?下面加
require_once(ECMS_PATH.'e/ecmsshop/aliyunoss/config.php');
找到
function GetFpicToTpic($classid,$id,$num=1,$getfirsttitlespic=0,$swidth=0,$sheight=0,$fstb=1){
把下面的
global $empire,$dbtbpre,$public_r,$class_r,$loginin,$logininid;
修改为
global $empire,$dbtbpre,$public_r,$class_r,$loginin,$logininid,$endpoint,$bucket,$alihttp;
继续找到
return $firsttitlepic;
在上面加
if($alihttp){
$r[url]=$alihttp.$firsttitlepic;
} else {
$r[url]="http://".$bucket.".".$endpoint.$firsttitlepic;
}
4.上传e目录到网站目录
5.修改 \e\ecmsshop\aliyunoss\config.php
aid和akey在 https://ak-console.aliyun.com/?spm=5176.8465980.quick-entry-bucket.d2.43d99720yWGk0Z#/accesskey 里面新建
endpoint在 https://oss.console.aliyun.com/overview 查看
bucket 自己新建一个即可
-------------***********下面的可以不管***********-------------------
6.新增 如果是帝国cms7.5 安装了多图上传功能 再按下面的进行修改
打开 /e/admin/ecmseditor/tranmore/tranmorefun.php
找到
global $empire,$dbtbpre,$public_r,$ecms_config;
替换为
global $empire,$dbtbpre,$public_r,$ecms_config,$endpoint,$bucket,$alihttp;
继续找到
$tranmore_picr[$i]['picname']=stripSlashes($fileno);
在下面加
if($alihttp){
$tranmore_picr[$i]['bigpicurl']=$alihttp.$tranmore_picr[$i]['bigpicurl'];
if($tranmore_picr[$i]['smallpicurl']){
$tranmore_picr[$i]['smallpicurl']=$alihttp.$tranmore_picr[$i]['smallpicurl'];
}
} else {
$tranmore_picr[$i]['bigpicurl']="http://".$bucket.".".$endpoint.$tranmore_picr[$i]['bigpicurl'];
if($tranmore_picr[$i]['smallpicurl']){
$tranmore_picr[$i]['smallpicurl']="http://".$bucket.".".$endpoint.$tranmore_picr[$i]['smallpicurl'];
}
}
ps.如果安装了yecha的新版后台 想ue也支持图片上传到阿里云oss 则把 imageUp.php 上传到 e/extend/ue/php/里面替换源文件即可!
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
帝国CMS-整合阿里云oss.zip (70个子文件)
已修改过的文件【替换前自己备份】
e
class
functions.php 224KB
connect.php 112KB
admin
ecmseditor
fileinc
editorpic.php 4KB
其他文件
发布接口.php 3KB
imageUp.php 4KB
修改教程.txt 4KB
e
ecmsshop
aliyunoss
index.php 54B
config.php 315B
src
OSS
Core
OssException.php 1KB
MimeTypes.php 10KB
OssUtil.php 13KB
Http
RequestCore.php 29KB
ResponseCore.php 2KB
LICENSE 2KB
RequestCore_Exception.php 79B
Result
GetLiveChannelHistoryResult.php 383B
PutLiveChannelResult.php 321B
ExistResult.php 802B
GetWebsiteResult.php 875B
GetRefererResult.php 876B
BodyResult.php 294B
ListMultipartUploadResult.php 2KB
ListBucketsResult.php 828B
DeleteObjectsResult.php 517B
UploadPartResult.php 498B
AclResult.php 732B
GetLiveChannelInfoResult.php 374B
Result.php 4KB
InitiateMultipartUploadResult.php 593B
GetCorsResult.php 767B
ListObjectsResult.php 3KB
ListPartsResult.php 2KB
GetCnameResult.php 346B
GetLifecycleResult.php 883B
CallbackResult.php 375B
ListLiveChannelResult.php 342B
GetLiveChannelStatusResult.php 380B
HeaderResult.php 482B
PutSetDeleteResult.php 354B
CopyObjectResult.php 552B
GetLoggingResult.php 876B
AppendResult.php 570B
Model
LiveChannelListInfo.php 2KB
PrefixInfo.php 780B
GetLiveChannelInfo.php 1KB
WebsiteConfig.php 2KB
LiveChannelConfig.php 3KB
BucketListInfo.php 613B
ListMultipartUploadInfo.php 3KB
PartInfo.php 1KB
XmlConfig.php 497B
LiveChannelHistory.php 1KB
GetLiveChannelStatus.php 2KB
CorsRule.php 3KB
CnameConfig.php 2KB
LifecycleConfig.php 3KB
ObjectInfo.php 2KB
LiveChannelInfo.php 2KB
LifecycleRule.php 2KB
ObjectListInfo.php 3KB
GetLiveChannelHistory.php 751B
UploadInfo.php 896B
LoggingConfig.php 2KB
RefererConfig.php 2KB
ListPartsInfo.php 2KB
LifecycleAction.php 2KB
CorsConfig.php 3KB
BucketInfo.php 1KB
OssClient.php 92KB
autoload.php 316B
共 70 条
- 1
yuexiupeng
- 粉丝: 1
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页