更新图床接口

This commit is contained in:
net909
2024-10-11 20:18:04 +08:00
parent 7c6d89ab17
commit 9614e31ebf
2 changed files with 30 additions and 6 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace plugin\utility\imghosting\api;
use Exception;
use plugin\utility\imghosting\api;
class locimg implements api
{
public function upload($filepath, $filename){
$url = 'https://www.locimg.com/upload/upload.html';
$referer = 'https://www.locimg.com/';
$file = new \CURLFile($filepath, 'image/jpeg', $filename);
$param = [
'image' => $file,
'fileId' => $filename,
];
$data = get_curl($url,$param,$referer,0,0,0,0,['X-Requested-With: XMLHttpRequest']);
$arr = json_decode($data,true);
if(isset($arr['data']['url'])){
return ['url'=>$arr['data']['url']];
}elseif(isset($arr['msg'])){
throw new Exception('上传失败请重试('.$arr['msg'].'');
}else{
throw new Exception('上传失败!接口错误');
}
}
}
+2 -6
View File
@@ -101,12 +101,8 @@ textarea.form-control{min-height: auto;}
key: 'dianping'
},
{
title: 'VIPKID',
key: 'vipkid'
},
{
title: '简单图床',
key: 'pngcm'
title: 'LOCIMG',
key: 'locimg'
},
{
title: 'IMGDD',