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

@ -98,7 +98,7 @@ class Upload
imagejpeg($background, $outputImagePath, 90);
imagedestroy($background);
imagedestroy($overlay);
$upload = new UploadPhoto($outputImagePath, 'cdn/img/');
self::$vidpreview = $upload->getSrc();
$upload = new UploadPhoto($mp4File, 'cdn/video/');

View file

@ -41,6 +41,20 @@ class Upload
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([
'region' => NGALLERY['root']['storage']['s3']['credentials']['region'],
'version' => NGALLERY['root']['storage']['s3']['credentials']['version'],