Skip to content

Commit 78868c1

Browse files
committed
update some
update some
1 parent d28af29 commit 78868c1

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

_layouts/post.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
---
44

55
<h1>{{ page.title}}</h1>
6-
<span>日期:{{ page.date | date: "%Y年%m月%d日" }}</span>
6+
<span class="pubtime">日期:{{ page.date | date: "%Y年%m月%d日" }}</span>
77

88
{{ content }}
99

_posts/2014-03-09-qiniu-upload-file.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ layout: post
33
title: 七牛抓取远程图片
44
---
55

6-
七牛有获取远程资源的API [API](http://developer.qiniu.com/docs/v6/api/reference/rs/fetch.html)
6+
七牛有获取远程资源的 [API](http://developer.qiniu.com/docs/v6/api/reference/rs/fetch.html)
77
可以把远程抓取的图片直接传到七牛服务器,在类似商品分享的程序上,可以大大减缓服务器压力。
88

99
上传远程图片需要二个步骤,首先 用自己的 access_key 和 secret_key 换取 access_token,
1010
然后用 POST 的方式向七牛的服务器发出请求,在请求的 header 加入 access_token, data 里放入编码后的
1111
图片 url 地址, 全部代码如下。
1212

13-
安全编码和签名运算都是从官方复制的。
13+
14+
15+
安全编码和签名运算都是从官方复制的。
16+
1417
/*
1518
*
1619
* @desc URL安全形式的base64编码
@@ -61,16 +64,15 @@ title: 七牛抓取远程图片
6164

6265

6366
$fetch = urlsafe_base64_encode('http://203.208.46.200/images/srpr/logo11w.png');
64-
$to = urlsafe_base64_encode('ibeircn:11.jpg');
67+
$to = urlsafe_base64_encode('七牛空间名:目标图片.jpg');
6568

66-
$url = 'http://iovip.qbox.me/fetch/'. $fetch .'/to/' . $to;
69+
$url = 'http://iovip.qbox.me/fetch/'. $fetch .'/to/' . $to; // 上传远程图片api地址
6770

68-
$access_token = generate_access_token($access_key, $secret_key, $url);
71+
$access_token = generate_access_token($access_key, $secret_key, $url);
6972

7073
$header[] = 'Content-Type: application/json';
7174
$header[] = 'Authorization: QBox '. $access_token;
7275

73-
7476
$con = send('iovip.qbox.me/fetch/'.$fetch.'/to/'.$to, $header);
7577
var_dump($con);
7678

css/github.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ github.com style (c) Vasily Polovnyov <vast@whiteants.net>
127127

128128
pre {
129129
border-radius: 10px;
130+
margin-top: 20px;
131+
margin-bottom: 20px;
130132
}
131133
code {
132-
font-family: Menlo,Monaco,"Andale Mono","lucida console","Courier New",monospace;
134+
135+
font-family: Consolas, "Liberation Mono", Courier, monospace;
136+
font-size: 12px;
133137
}

css/style.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ a {
5353
float: right;
5454
text-align: center;
5555
}
56-
56+
.pubtime {
57+
color: #888;
58+
}
5759

5860

0 commit comments

Comments
 (0)