doggo upload
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s

This commit is contained in:
2023-10-26 13:46:55 +02:00
parent 61d7ae9adf
commit 12c11b65ba
5 changed files with 132 additions and 4 deletions

View File

@ -209,4 +209,32 @@ function uuid4($data = null) {
// Output the 36 character UUID.
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
}
/*
* @param $path string Path to the file that should be uploaded
* @param $hash string Optional. File name we want on pictshare for the file
*/
function pictshareUploadImage($path,$hash=false)
{
if(!file_exists($path)) return false;
$request = curl_init('https://i.haschek.at/api/upload.php');
curl_setopt($request, CURLOPT_POST, true);
curl_setopt(
$request,
CURLOPT_POSTFIELDS,
array(
'file' => curl_file_create($path),
'hash'=>$hash
));
// output the response
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
$json = json_decode(curl_exec($request).PHP_EOL,true);
// close the session
curl_close($request);
return $json;
}