Fix: Исправлен путь к файлу в generateThumbnail()

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
mirivlad 2026-03-26 12:41:06 +08:00
parent b3d1daeea6
commit f48c22f75a
1 changed files with 3 additions and 2 deletions

View File

@ -22,7 +22,8 @@ class CourseController extends Controller
private function generateThumbnail($imagePath, $width = 400, $height = 300)
{
$manager = new ImageManager(new Driver());
$image = $manager->read($imagePath);
$fullPath = storage_path('app/public/' . $imagePath);
$image = $manager->read($fullPath);
// Пропорциональное уменьшение с crop по центру
$image->cover($width, $height, 'center');
@ -31,7 +32,7 @@ class CourseController extends Controller
$thumbPath = str_replace('.', '_thumb.', $imagePath);
$image->save(storage_path('app/public/' . $thumbPath));
return str_replace('.', '_thumb.', $imagePath);
return $thumbPath;
}
private function deleteThumbnails($path)