This commit is contained in:
2026-04-15 19:34:56 +05:00
parent 34ffed1e4a
commit e243821f50
26 changed files with 2072 additions and 1258 deletions

View File

@@ -101,31 +101,11 @@ class Store extends FormRequest
*/
public function getPosterThumb()
{
$url = $this->storeImageToS3($this->file('poster'));
return $url;
}
private function storeImageToS3($image): string
{
$path = '';
// first store temp file and resize it, then upload to s3
// 1 - store temp file
$image = $this->file('poster');
$tempPath = $image->store('temp', 'public');
if ($tempPath) {
// $tempFilePath = storage_path('app/public/' . $tempPath);
$image = new ImageResize();
$path = $image->resize($tempPath, 322, 'posters');
// 2 - upload to s3 or keep local
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
Storage::disk('s3')->put($path, file_get_contents($path));
unlink($path);
}
}
return $path;
$resizer = new ImageResize();
return $resizer->resize($tempPath, 322, 'posters', true);
}
/**