Je veux changer le nom de l'image, suivez la vidéo id dans Laravel projet. Comment résoudre ce problème?
Voici les codes de contrôleur
$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;
}
}