Skip to content
This repository has been archived by the owner on Nov 20, 2021. It is now read-only.

Commit

Permalink
v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueSkyXN committed May 13, 2020
0 parents commit c7cfe3c
Show file tree
Hide file tree
Showing 4 changed files with 450 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#源程序名: autoPicCdn

白嫖Github的存储空间,通过jsdelivr全球加速(含有国内节点). 实现图床的目的.

目录介绍:

```
.
├── index.html # 简单上传页面
├── README.md
└── up.php # 上传接口,需要能访问github,建议放到非大陆服务器
0 directories, 3 files
```

使用:

配置选项

> https://github.com/settings/tokens 去这个页面生成一个有写权限的token(write:packages前打勾)然后配置up.php中的相关字段..
> ```php
> define("REPO","testforapi");//必须是下面用户名下的公开仓库
> define("USER","yumusb");//必须是当前GitHub用户名
> define("MAIL","[email protected]");//
> define("TOKEN","YourToken");
> ```
就可以享受白嫖带来的乐趣了!
更新记录:
+ 2020.03.27 重写交互方式,且现已支持`PicGo`中的`web-uploader`插件(Zqian),配置API地址就写up.php的地址,POST参数填写`pic`
如果有帮助到你 欢迎赞赏 http://33.al/donate(原作者)
上面内容为原版备注
本版本为BlueSkyXN自用的修改版
index1是原版微调版本,黑色背景,自行修改下方链接和文字等即可
index2是背景修改版,修改背景请在Html中标注位置修改即可
请更名为index(或者修改宝塔面板中该站点默认文件)
160 changes: 160 additions & 0 deletions index1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta name="referrer" content="no-referrer"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
<title>SKYの公共图床</title>
<link href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdn.bootcss.com/jquery/3.4.0/jquery.min.js" type="text/javascript"></script>
<style type="text/css">
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
"Helvetica Neue", Arial, sans-serif;
background: #333;
}
@font-face {
font-family: webfont_2;
}
.text-center {
text-align: center;
}
.text-white {
color: #fff;
}
.footer,
.header {
margin: 30px;
color: #fff;
}
.title1 {
font-size: 20px;
}
.title2 {
font-size: 24px;
font-family: webfont_2 !important;
}
.jumbotron {
margin: auto;
text-align: center;
background-color: rgba(255, 255, 255, 0.3);
}
.jumbotron input[type="file"] {
opacity: 0;
width: 102px;
height: 31px;
position: absolute;
display: inline-block;
}
.preview {
color: #fff;
}
.preview img {
max-width: 10%;
}
.preview p {
word-break: break-all;
word-wrap: break-word;
font-size: 13px !important;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12 header text-center">
<p class="title2">
SKYの公共图床
</p>
</div>
<div class="col-md-8 col-xs-10 jumbotron" style="margin: auto;">
<div class="mselector">
<input type="file" name="upimage" id="upload_file" accept="image/*"/>
<button class="btn btn-primary btn-sm" type="button">
选择本地图片
</button>
</div>
<hr/>
<div class="textarea_con">
<textarea class="form-control" id="url-res-txt" style="margin-top: 10px;background-color: #ececec;" rows="3"></textarea>
</div>
<div class="preview">
<hr/>
</div>
</div>
<div class="footer text-center">
<p style="color: #ececec;">
服务器带宽为1M,请耐心等待,上传完毕后需要等待一会儿图片URL才能给出并生效<br>
本图床基于Github+JsJsDelivr(理论限制文件大小50M)本站使用易加速的美西CDN<br>
欢迎访问我的博客——<a href="https://www.bluesky.cf/">苍穹の下</a>
</p>
</div>
</div>
</div>
<div tabindex="-1" class="modal fade" id="url_upload_model" role="dialog" aria-hidden="true" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<textarea name="urls" class="form-control" id="urls" rows="8"></textarea>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
<script type="text/javascript">
$("input[type='file']").change(function(e) {
gen_base64();
});
function $_(id) {
return document.getElementById(id);
}
function gen_base64() {
var file = $_("upload_file").files[0];
if (!/image\/\w+/.test(file.type)) {
alert("请确保文件为图像类型");
return false;
}
r = new FileReader(); //本地预览
r.onload = function() {
let formdata=new FormData; //创建FormData对象,代表文件传输
formdata.append("pic", file);
$.ajax({
type: "post",
url: "up.php",
processData:false, //不让指定数据处理方式
contentType:false, //不让指定传输格式
dataType: "json",
data: formdata,
async: true,
success: function(res) {
if (res.code == 'success') {
$(".container-fluid .row-fluid .textarea_con").html(
'<textarea id="url-res-txt" class="form-control" rows="8" style="margin-top: 10px;background-color: #ececec;">' + document.getElementById("url-res-txt").value +
res.data.url + "\n" +
"</textarea>"
);
} else {
alert("fail");
}
},
error: function(a) {
alert("失败");
}
});
};
r.readAsDataURL(file); //Base64
}
window.onload = function() {
if (typeof FileReader === "undefined") {
alert("抱歉,你的浏览器不支持 FileReader,请使用现代浏览器操作!");
$_("upload_file").disabled = true;
}
};
</script>
</body>
<footer style="text-align:center;">
<p>友链:<a href="https://blueskyxn.xyz">SKYの主页</a><a href="https://www.bluesky.cf">SKYの博客-苍穹の下</a><a href="https://www.blueskyxn.xyz">大陆版</a><a href="https://www.img.bluesky.cf">SKYの随机图</a><a href="https://www.skyvpn.cf">科学の网</a> | <a href="https://www.skyimg.cf">SKYの公共图床</a> </p>
</footer>
</html>
176 changes: 176 additions & 0 deletions index2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta name="referrer" content="no-referrer"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
<title>SKYの公共图床</title>
<!--上面这个是标题-->
<link href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdn.bootcss.com/jquery/3.4.0/jquery.min.js" type="text/javascript"></script>
<style type="text/css">
body {
<!--下面是背景图修改内容-->
height: 100%;
background-color: #ffffff;
background-image: url("images/overlay.png"), -moz-linear-gradient(60deg, rgba(255, 165, 150, 0.5) 5%, rgba(0, 228, 255, 0.35)), url("https://ae01.alicdn.com/kf/Hda0abae4a73c49a582f378cd24912d606.jpg");
background-image: url("images/overlay.png"), -webkit-linear-gradient(60deg, rgba(255, 165, 150, 0.5) 5%, rgba(0, 228, 255, 0.35)), url("https://ae01.alicdn.com/kf/Hda0abae4a73c49a582f378cd24912d606.jpg");
background-image: url("images/overlay.png"), -ms-linear-gradient(60deg, rgba(255, 165, 150, 0.5) 5%, rgba(0, 228, 255, 0.35)), url("https://ae01.alicdn.com/kf/Hda0abae4a73c49a582f378cd24912d606.jpg");
background-image: url("images/overlay.png"), linear-gradient(60deg, rgba(255, 165, 150, 0.5) 5%, rgba(0, 228, 255, 0.35)), url("https://ae01.alicdn.com/kf/Hda0abae4a73c49a582f378cd24912d606.jpg");
background-repeat: repeat, no-repeat, no-repeat;
background-size: 100px 100px, cover, cover;
background-position: top left, center center, bottom center;
background-attachment: fixed, fixed, fixed;

<!--上面是背景图修改内容-->
<!--修改url后面地址就可以换图片了-->
<!--下面这个也是body内容,没有改动-->
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
"Helvetica Neue", Arial, sans-serif;
<!--源代码(已被我注释掉,换成上面的): background: #333;-->
}
@font-face {
font-family: webfont_2;
}
.text-center {
text-align: center;
}
.text-white {
color: #fff;
}
.footer,
.header {
margin: 30px;
color: #fff;
}
.title1 {
font-size: 20px;
}
.title2 {
font-size: 24px;
font-family: webfont_2 !important;
}
.jumbotron {
margin: auto;
text-align: center;
background-color: rgba(255, 255, 255, 0.3);
}
.jumbotron input[type="file"] {
opacity: 0;
width: 102px;
height: 31px;
position: absolute;
display: inline-block;
}
.preview {
color: #fff;
}
.preview img {
max-width: 10%;
}
.preview p {
word-break: break-all;
word-wrap: break-word;
font-size: 13px !important;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12 header text-center">
<p class="title2">
SKYの公共图床
</p>
</div>
<div class="col-md-8 col-xs-10 jumbotron" style="margin: auto;">
<div class="mselector">
<input type="file" name="upimage" id="upload_file" accept="image/*"/>
<button class="btn btn-primary btn-sm" type="button">
选择本地图片
</button>
</div>
<hr/>
<div class="textarea_con">
<textarea class="form-control" id="url-res-txt" style="margin-top: 10px;background-color: #ececec;" rows="3"></textarea>
</div>
<div class="preview">
<hr/>
</div>
</div>
<div class="footer text-center">
<p style="color: #ececec;">
服务器带宽为1M,请耐心等待,上传完毕后需要等待一会儿图片URL才能给出并生效<br>
本图床基于Github+JsJsDelivr(理论限制文件大小50M)本站使用易加速的美西CDN<br>
欢迎访问我的博客——<a href="https://www.bluesky.cf/">苍穹の下</a>
</p>
</div>
</div>
</div>
<div tabindex="-1" class="modal fade" id="url_upload_model" role="dialog" aria-hidden="true" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<textarea name="urls" class="form-control" id="urls" rows="8"></textarea>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
<script type="text/javascript">
$("input[type='file']").change(function(e) {
gen_base64();
});
function $_(id) {
return document.getElementById(id);
}
function gen_base64() {
var file = $_("upload_file").files[0];
if (!/image\/\w+/.test(file.type)) {
alert("请确保文件为图像类型");
return false;
}
r = new FileReader(); //本地预览
r.onload = function() {
let formdata=new FormData; //创建FormData对象,代表文件传输
formdata.append("pic", file);
$.ajax({
type: "post",
url: "up.php",
processData:false, //不让指定数据处理方式
contentType:false, //不让指定传输格式
dataType: "json",
data: formdata,
async: true,
success: function(res) {
if (res.code == 'success') {
$(".container-fluid .row-fluid .textarea_con").html(
'<textarea id="url-res-txt" class="form-control" rows="8" style="margin-top: 10px;background-color: #ececec;">' + document.getElementById("url-res-txt").value +
res.data.url + "\n" +
"</textarea>"
);
} else {
alert("fail");
}
},
error: function(a) {
alert("失败");
}
});
};
r.readAsDataURL(file); //Base64
}
window.onload = function() {
if (typeof FileReader === "undefined") {
alert("抱歉,你的浏览器不支持 FileReader,请使用现代浏览器操作!");
$_("upload_file").disabled = true;
}
};
</script>
</body>
<footer style="text-align:center;">
<p>友链:<a href="https://blueskyxn.xyz">SKYの主页</a><a href="https://www.bluesky.cf">SKYの博客-苍穹の下</a><a href="https://www.blueskyxn.xyz">大陆版</a><a href="https://www.img.bluesky.cf">SKYの随机图</a><a href="https://www.skyvpn.cf">科学の网</a> | <a href="https://www.skyimg.cf">SKYの公共图床</a> </p>
</footer>
</html>
Loading

0 comments on commit c7cfe3c

Please sign in to comment.