ImageMagick 扩展在此 PHP 安装中不可用

问题描述 投票:0回答:1

我正在使用 Laravel 10 和我的 PHP 版本 => 8.2.12。

我正在使用 Xampp 进行可能的项目。我无法解决这个错误

if ($request->hasFile('product_images')) {
    // $productImageModel = app(ProductsImage::class);
    // $imagePaths = $productImageModel->typeImage($request, $product_id);
    
    $manager = new ImageManager(new Driver());
    
    $name_gen = hexdec(uniqid()) . '.' . $request->file('image')->getClientOriginalName();
    $im = $manager->read($request->file('product_images'));
    $im = $im->resize(370, 246);
    $im->toJpeg(80)->save(base_path('public/front/images/products/large/' . $name_gen));
}

错误:

干预\图像\异常\运行时异常 PHP 8.2.12 10.40.0 ImageMagick 扩展在此 PHP 安装中不可用。

php laravel file-upload
1个回答
0
投票

您需要在本地系统中安装 ImageMagick。 参考这个:https://imagemagick.org/script/download.php

其他解决方案是将 Composer 与 php/laravel 一起使用。

© www.soinside.com 2019 - 2024. All rights reserved.