storage url o'zgartirildi
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Jobs\Dashboard\Product;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Models\Screen;
|
||||
use App\Support\Uploads;
|
||||
use Carbon\Carbon;
|
||||
use App\Api\ImageResize;
|
||||
use App\Http\Requests\Dashboard\Product\Store as StoreRequest;
|
||||
@@ -54,10 +55,10 @@ class Child
|
||||
$folder = Carbon::now()->format('Y/m/d');
|
||||
|
||||
// Store original
|
||||
$path = $screen['image']->store("uploads/screens/{$folder}");
|
||||
$path = Uploads::store($screen['image'], "uploads/screens/{$folder}");
|
||||
|
||||
// Store and resize thumb
|
||||
$tempPath = $screen['image']->store('temp', 'public');
|
||||
$tempPath = Uploads::store($screen['image'], 'temp', 'public');
|
||||
$thumbPath = $this->image->resize($tempPath, 322, 'screens', true);
|
||||
|
||||
$this->size = Storage::size($path);
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Jobs\Dashboard\Product;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Models\Screen;
|
||||
use App\Support\Uploads;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Api\ImageResize;
|
||||
@@ -83,10 +84,10 @@ class ChildUpdate
|
||||
$folder = Carbon::now()->format('Y/m/d');
|
||||
if ($screen['image']) {
|
||||
// 1. Store original (S3 if enabled)
|
||||
$path = $screen['image']->store("uploads/screens/{$folder}");
|
||||
$path = Uploads::store($screen['image'], "uploads/screens/{$folder}");
|
||||
|
||||
// 2. Local temp for resizing
|
||||
$tempPath = $screen['image']->store('temp', 'public');
|
||||
$tempPath = Uploads::store($screen['image'], 'temp', 'public');
|
||||
$thumbPath = $this->image->resize($tempPath, 322, 'screens', true);
|
||||
|
||||
Screen::create([
|
||||
@@ -94,7 +95,7 @@ class ChildUpdate
|
||||
'path_thumb' => $thumbPath,
|
||||
'name' => basename($path),
|
||||
'product_id' => $child_id,
|
||||
'size' => Storage::disk(env('FILESYSTEM_DISK'))->size($path)
|
||||
'size' => Storage::size($path)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Jobs\Dashboard\Product;
|
||||
|
||||
use App\Support\Uploads;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Arr;
|
||||
use App\Models\Screen as Screens;
|
||||
@@ -38,17 +39,17 @@ class Screen
|
||||
$folder = Carbon::now()->format('Y/m/d');
|
||||
|
||||
// 1. Store original (S3 if enabled)
|
||||
$path = $screen->store("uploads/screens/original/{$folder}");
|
||||
$path = Uploads::store($screen, "uploads/screens/original/{$folder}");
|
||||
|
||||
// 2. Local temp for resizing
|
||||
$tempPath = $screen->store('temp', 'public');
|
||||
$tempPath = Uploads::store($screen, 'temp', 'public');
|
||||
$thumb = $this->img->resize($tempPath, 350, 'screens', true);
|
||||
|
||||
$screens = new Screens();
|
||||
$screens->name = basename($path);
|
||||
$screens->path = $path;
|
||||
$screens->path_thumb = $thumb;
|
||||
$screens->size = Storage::disk(env('FILESYSTEM_DISK'))->size($path);
|
||||
$screens->size = Storage::size($path);
|
||||
$screens->product_id = $this->id;
|
||||
$screens->save();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user