나는 원하는 이미지를 변경 이름을 따라 동영상 id 에 Laravel 프로젝트입니다. 이 문제를 해결하는 방법?
여기에는 코드를 컨트롤러
$old_video = Video::find($id);
//video thumbnail uploaded
if ($request->hasFile('image_path') != '') {
$video_themnull = $request->file('image_path');
$video_themnull_name = uniqid() . Str::random('10') . '.' . $video_themnull->getClientOriginalExtension();
$video_themnull_resize = Image::make($video_themnull->getRealPath());
$video_themnull_resize->resize(400, 200);
if ($video_themnull->isValid()) {
if (isset($old_video->image_path)) {
$files_old = $old_video->image_path;
if ( file_exists($files_old)) {
unlink($files_old);
}
}
$video_themnull_resize->save(public_path('video/themnull/' . $video_themnull_name));
$image_path = 'public/video/themnull/' . $video_themnull_name;
}
}