test
This commit is contained in:
@@ -79,19 +79,23 @@ class ChildUpdate
|
||||
{
|
||||
if (!empty($screens)) {
|
||||
foreach ($screens as $screen) {
|
||||
if ($screen['id'] == 'undefined' || $screen['id'] == 'null' || $screen['id'] = null) {
|
||||
if ($screen['id'] == 'undefined' || $screen['id'] == 'null' || $screen['id'] == null) {
|
||||
$folder = Carbon::now()->format('Y/m/d');
|
||||
if ($screen['image']) {
|
||||
// 1. Store original (S3 if enabled)
|
||||
$path = $screen['image']->store("uploads/screens/{$folder}");
|
||||
$image = Screen::create([
|
||||
|
||||
// 2. Local temp for resizing
|
||||
$tempPath = $screen['image']->store('temp', 'public');
|
||||
$thumbPath = $this->image->resize($tempPath, 322, 'screens', true);
|
||||
|
||||
Screen::create([
|
||||
'path' => $path,
|
||||
'path_thumb' => "uploads/screens/thumbs/{$folder}/" . basename($path),
|
||||
'path_thumb' => $thumbPath,
|
||||
'name' => basename($path),
|
||||
'product_id' => $child_id,
|
||||
'size' => Storage::size($path)
|
||||
'size' => Storage::disk(env('FILESYSTEM_DISK'))->size($path)
|
||||
]);
|
||||
|
||||
$this->image->resize($image->path, 322, 'screens');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user