yb / qiniu-file-for-typecho Goto Github PK
View Code? Open in Web Editor NEW将 Typecho 的附件保存至七牛云存储
将 Typecho 的附件保存至七牛云存储
1.在Github上直接下载下来的版本(master)上传到网站上,点下启用插件就显示500 错误,typecho1.0,目前我使用的是这个版本就没有问题:http://pan.baidu.com/s/1hq43dys
2.目前网站和插件已经正确配置,我想问一下这个插件在上传图片后是直接上传到七牛,还是仍然上传到本地空间,在第一次访问时才拉取到七牛?需不需要在七牛空间那边设置镜像加速?
3.希望增加对本地css/js等等静态文件的cdn加速功能(我觉得这个直接使用文件地址替换即可)
增加 byte 流写入内容的考虑
用于XMLRPC接口上传附件因为XMLRPC上传用的byte流写入数据
108行
$filename = $file['tmp_name'];
if (!isset($filename)) return false;
将其删掉
116行到127行
if ($error == null) .... else return false;
将其改为
if (isset($file['bytes'])) {
list($ret, $error) = $upManager->put($token, $option->savepath . $file['name'], $file['bytes']);
if ($error == null) {
return array(
'name' => $file['name'],
'path' => $option->savepath . $file['name'] . ($option->imgstyle == '' ? '' : '-' . $option->imgstyle),
'size' => $file['size'],
'type' => $ext,
'mime' => $file['mime']//Typecho_Common::mimeContentType($option->savepath . $file['name'])
);
} else {
return false;
}
} else {
// 上传文件
$filename = $file['tmp_name'];
//if (!isset($filename)) return false;
list($ret, $error) = $upManager->putFile($token, $option->savepath . $file['name'], $filename);
if ($error == null) {
return array(
'name' => $file['name'],
'path' => $option->savepath . $file['name'] . ($option->imgstyle == '' ? '' : '-' . $option->imgstyle),
'size' => $file['size'],
'type' => $ext, 'mime' => Typecho_Common::mimeContentType($filename)
);
} else {
return false;
}
}
记得吧文件夹改名为:
QiniuFile
放入/usr/plugins文件夹下面
否则在1.0下不能正常激活。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.