This commit is contained in:
2026-04-15 23:46:32 +05:00
parent 6a606044a9
commit 18ffc772e3
3 changed files with 7 additions and 18 deletions

View File

@@ -271,14 +271,7 @@ class Controller extends ExController
foreach ($product->childrens as $children) { foreach ($product->childrens as $children) {
foreach ($children->screens as $screen) { foreach ($children->screens as $screen) {
$screen->sizeText = $screen->size / 1024 . 'Kb'; $screen->sizeText = $screen->size / 1024 . 'Kb';
if (env('FILESYSTEM_DISK') == 's3') { $screen->url = $screen->getPath();
$screen->url = Storage::temporaryUrl(
$screen->path,
Date::now()->addMinutes(5)
);
} else {
$screen->url = '/' . $screen->path;
}
$screen->type = "image/jpeg"; $screen->type = "image/jpeg";
} }
} }

View File

@@ -53,12 +53,10 @@ class Screen extends Model
public function getPath(): string public function getPath(): string
{ {
if (!empty($this->path)) { if (!empty($this->path)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) { if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
return Storage::temporaryUrl( return Storage::url($this->path);
$this->path, Date::now()->addMinutes(5)
);
} }
return (string) $this->path; return config('app.url') . '/' . $this->path;
} }
return (string) 'image/no_screen.png'; return (string) 'image/no_screen.png';
@@ -70,12 +68,10 @@ class Screen extends Model
public function getPathThumb(): string public function getPathThumb(): string
{ {
if (!empty($this->path_thumb)) { if (!empty($this->path_thumb)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) { if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
return Storage::temporaryUrl( return Storage::url($this->path_thumb);
$this->path_thumb, Date::now()->addMinutes(5)
);
} }
return (string) $this->path_thumb; return config('app.url') . '/' . $this->path_thumb;
} }
return (string) 'image/no_screen_thumb.png'; return (string) 'image/no_screen_thumb.png';

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB