-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from mokeyjay/develop
5.1
- Loading branch information
Showing
15 changed files
with
298 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace app\ImageHosting; | ||
|
||
use app\Libs\Curl; | ||
use app\Libs\Log; | ||
|
||
/** | ||
* 58 同城图床(有时会和谐一些图) | ||
* 鸣谢:[@metowolf](https://github.com/metowolf) | ||
* Class FiftyEight | ||
* @package app\ImageHosting | ||
*/ | ||
class FiftyEight extends ImageHosting | ||
{ | ||
public function upload($path) | ||
{ | ||
$data = [ | ||
'Pic-Size' => '0*0', | ||
'Pic-Encoding' => 'base64', | ||
'Pic-Path' => '/nowater/webim/big/', | ||
'Pic-Data' => base64_encode(file_get_contents($path)), | ||
]; | ||
$result = Curl::post('https://upload.58cdn.com.cn/json', json_encode($data), [ | ||
CURLOPT_HTTPHEADER => [ | ||
'Origin: https://ai.58.com', | ||
'Referer: https://ai.58.com/pc/' | ||
], | ||
]); | ||
|
||
$data['Pic-Data'] = '(数据长度:' . strlen($data['Pic-Data']) . ')'; | ||
Log::write('[58图床]上传:' . json_encode($data)); | ||
Log::write('[58图床]返回:' . $result); | ||
|
||
if (empty($result) || stripos($result, 'n_v2') !== 0) { | ||
Log::write('[58图床]上传失败', 'ERROR'); | ||
return false; | ||
} | ||
|
||
return 'https://pic3.58cdn.com.cn/nowater/webim/big/' . $result; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace app\ImageHosting; | ||
|
||
use app\Libs\Curl; | ||
use app\Libs\Log; | ||
|
||
/** | ||
* 京东 | ||
* Class Jd | ||
* @package app\ImageHosting | ||
* @url https://www.jd.com/ | ||
*/ | ||
class Jd extends ImageHosting | ||
{ | ||
public function upload($path) | ||
{ | ||
$data = [ | ||
'appId' => 'im.customer', | ||
'aid' => 'undefined', | ||
'clientType' => 'comet', | ||
'pin' => 'undefined', | ||
's' => 'data:image/jpg;base64,' . base64_encode(file_get_contents($path)), | ||
]; | ||
$result = Curl::post('https://imio.jd.com/uploadfile/file/post.do', $data, [ | ||
CURLOPT_HTTPHEADER => [ | ||
'accept: application/json, text/plain, */*', | ||
'referer: https://jdcs.jd.com/jdchat/custom.action?entry=jd_fwztc', | ||
'origin: https://jdcs.jd.com', | ||
'Upgrade-insecure-requests: 1', | ||
], | ||
]); | ||
|
||
$data['s'] = '(数据长度:' . strlen($data['s']) . ')'; | ||
Log::write('[京东]上传:' . json_encode($data)); | ||
Log::write('[京东]返回:' . $result); | ||
|
||
preg_match_all('|https://(.*?)"|', $result, $result); | ||
if (!empty($result[1][0])) { | ||
return "https://{$result[1][0]}"; | ||
} | ||
|
||
Log::write('[京东]上传失败', 'ERROR'); | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace app\ImageHosting; | ||
|
||
use app\Libs\Curl; | ||
use app\Libs\Log; | ||
use app\Libs\Str; | ||
|
||
/** | ||
* 薄荷图床(国内,香港腾讯云) | ||
* Class riyugo | ||
* @package app\ImageHosting | ||
* @url https://riyugo.com/ | ||
*/ | ||
class Riyugo extends ImageHosting | ||
{ | ||
public function upload($path) | ||
{ | ||
$data = [ | ||
'name' => pathinfo($path, PATHINFO_BASENAME), | ||
'uuid' => 'o_1gbng' . Str::random(22), | ||
'nameMode' => 'isRenameMode', | ||
'file' => Curl::getCurlFile($path), | ||
]; | ||
$result = Curl::post('https://4ae.cn/localup.php', $data, [ | ||
CURLOPT_HTTPHEADER => [ | ||
'accept: */*', | ||
'referer: https://riyugo.com/', | ||
'origin: https://riyugo.com', | ||
], | ||
]); | ||
|
||
Log::write('[薄荷图床]上传:' . json_encode($data)); | ||
Log::write('[薄荷图床]返回:' . $result); | ||
|
||
$json = json_decode($result, true); | ||
if (isset($json['result']) && $json['result'] == 'success' && !empty($json['url'])) { | ||
return $json['url']; | ||
} | ||
|
||
Log::write('[薄荷图床]上传失败', 'ERROR'); | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.