2.7.0 dev

* 2023-01-26 v2.7.0 dev
- 增加广场非图片图标
- 替换访问生成缩略图代码
- 更新一些组件
- 优化代码
This commit is contained in:
icret
2023-01-26 12:32:04 +08:00
parent 9af638a2bd
commit 6409be96fb
31 changed files with 2396 additions and 296 deletions

View File

@@ -93,23 +93,71 @@ location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
```
#### API上传
- 需要开启图床安全->API上传示例
<details><summary>通过API上传示例</summary>
- html示例
```html
<form action="http://127.0.0.1/api/index.php" method="post" enctype="multipart/form-data">
<input type="file" name="image" accept="image/*">
<input type="text" name="token" placeholder="在tokenList文件找到token并输入" /> <input type="submit" />
</form>
```
- Python示例
```python
import requests
url = "https://png.cm/api/index.php"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"token\"\r\n\r\n8337effca0ddfcd9c5899f3509b23657\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"\r\n\r\n195124.jpg\r\n-----011000010111000001101001--\r\n\r\n"
headers = {"content-type": "multipart/form-data; boundary=---011000010111000001101001"}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
```
- curl示例
```curl
curl --request POST \
--url https://png.cm/api/index.php \
--header 'content-type: multipart/form-data' \
--form token=8337effca0ddfcd9c5899f3509b23657 \
--form image=@195124.jpg
```
- JQuery示例
```jQuery
const form = new FormData();
form.append("token", "8337effca0ddfcd9c5899f3509b23657");
form.append("image", "195124.jpg");
const settings = {
"async": true,
"crossDomain": true,
"url": "https://png.cm/api/index.php",
"method": "POST",
"headers": {},
"processData": false,
"contentType": false,
"mimeType": "multipart/form-data",
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
```
</details>
- 需要开启图床安全->API上传示例
- 上传成功后返回JSON
```json
{
"result": "success",
"code": 200,
"url": "http://127.0.0.1/i/2022/05/03/vfyjtq-0.png",
"srcName": "2532516028",
"thumb": "http://127.0.0.1/application/thumb.php?img=/i/2022/05/03/vfyjtq-0.png",
"del": "http://127.0.0.1/application/del.php?hash=ZnVzYlZEM0dJUWhiQ2UzVVVsK1haMG5nNk92K0d3Q3JldjMyWlF5bHFxcz0="
}
{
"result":"success","code":200,
"url":"https:\/\/i2.100024.xyz\/2023\/01\/24\/10gwv0y-0.webp",
"srcName":"195124",
"thumb":"https:\/\/png.cm\/application\/thumb.php?img=\/i\/2023\/01\/24\/10gwv0y-0.webp",
"del":"https:\/\/png.cm\/application\/del.php?hash=bW8vWG4vcG8yM2pLQzRJUGI0dHlTZkN4L2grVmtwUTFhd1A4czJsbHlMST0="
}
```
## 程序升级
@@ -183,6 +231,12 @@ $HTTP["url"] =~ "^/(i|public)/" {
<details><summary>点击查看2.0版更新日志</summary>
* 2023-01-26 v2.7.0 dev
- 增加广场非图片图标
- 替换访问生成缩略图代码
- 更新一些组件
- 优化代码
* 2023-01-21 v2.6.9 Happy New Year
- 修复BMP格式无法增加水印(不建议开启,非常耗时)
- 修复上传用户组会串联变成管理员权限 [#61](https://github.com/icret/EasyImages2.0/issues/61)