上传的文件支持替换访问域名

This commit is contained in:
Jerry Yan 2024-09-16 13:10:13 +08:00
parent f312e29d6f
commit eb451dd321
2 changed files with 4 additions and 1 deletions

View File

@ -2,7 +2,6 @@
namespace App\Http\Controllers;
use http\Url;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Storage;

View File

@ -41,12 +41,14 @@ class ProgramVideoConstructController extends BaseController
$file = $request->file("start_image");
$path = $file->store("lubo_file");
$full_path = Storage::url($path);
$full_path = str_replace(env("AWS_ENDPOINT"), env("AWS_ACCESS_DOMAIN"), $full_path);
$program_video->start_image = $full_path;
}
if ($request->hasFile("stop_image")) {
$file = $request->file("stop_image");
$path = $file->store("lubo_file");
$full_path = Storage::url($path);
$full_path = str_replace(env("AWS_ENDPOINT"), env("AWS_ACCESS_DOMAIN"), $full_path);
$program_video->stop_image = $full_path;
}
if ($request->has("created_at")) {
@ -78,12 +80,14 @@ class ProgramVideoConstructController extends BaseController
$file = $request->file("start_image");
$path = $file->store("lubo_file");
$full_path = Storage::url($path);
$full_path = str_replace(env("AWS_ENDPOINT"), env("AWS_ACCESS_DOMAIN"), $full_path);
$program_video->start_image = $full_path;
}
if ($request->hasFile("stop_image")) {
$file = $request->file("stop_image");
$path = $file->store("lubo_file");
$full_path = Storage::url($path);
$full_path = str_replace(env("AWS_ENDPOINT"), env("AWS_ACCESS_DOMAIN"), $full_path);
$program_video->stop_image = $full_path;
}
if ($request->has("created_at")) {