Fix: Исправлен путь к файлу в generateThumbnail()
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
b3d1daeea6
commit
f48c22f75a
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue