add directive cloudflare-bypass

If video size larger of 90 mb, they uploads to local server
This commit is contained in:
themohooks 2024-10-09 22:32:40 +03:00
parent e65d3402d2
commit beaf493cb6
2 changed files with 15 additions and 1 deletions

View file

@ -41,6 +41,20 @@ class Upload
if (strtolower (NGALLERY['root']['storage']['type']) == "s3") if (strtolower (NGALLERY['root']['storage']['type']) == "s3")
{ {
if (NGALLERY['root']['video']['upload']['cloudflare-bypass'] === true) {
if ($location === 'cdn/video') {
if (filesize($_SERVER['DOCUMENT_ROOT'].'/'.$location.$filecdn) >= 94371840) {
mkdir("{$_SERVER['DOCUMENT_ROOT']}/uploads/{$location}", 0777, true);
move_uploaded_file ($tmpname, "{$_SERVER['DOCUMENT_ROOT']}/uploads/{$folder}");
$this->type = $type;
$this->src = "/uploads/{$folder}";
$this->size = self::human_filesize(filesize($tmpname));
$this->name = $name;
return;
}
}
}
$s3 = new \Aws\S3\S3Client([ $s3 = new \Aws\S3\S3Client([
'region' => NGALLERY['root']['storage']['s3']['credentials']['region'], 'region' => NGALLERY['root']['storage']['s3']['credentials']['region'],
'version' => NGALLERY['root']['storage']['s3']['credentials']['version'], 'version' => NGALLERY['root']['storage']['s3']['credentials']['version'],