0

我已经安装了干预/图像。

这是我从修补匠那里得到的:

C:\Users\USER\p3>composer require intervention/image
Using version ^2.5 for intervention/image
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: intervention/image
Discovered Package: laravel/tinker
Discovered Package: laravel/ui
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.

然后我使用了这样的包:

use Intervention\Image\Facades\Image

然后我应用了这样的代码:

image = Image::make(public_path("storage/{$imagePath}"))->fit(1200, 1200);`

我得到的错误是:

Intervention\Image\Exception\NotSupportedException GD 库扩展在此 PHP 安装中不可用。

关于如何解决这个问题的任何建议?

4

2 回答 2

0

我也遇到了这个问题。我在使用 Laravel 开发代码时购买了它。乌班图;apt-get install libpng-dev Centos;yum install libpng-devel 这已通过下载解决。

于 2020-09-14T05:54:45.237 回答
0

它说在您的系统中 GD 库不可用这是启用 GD 库的步骤

sudo apt-get install php7.4-gd

安装后找到你的 php.ini 文件并取消注释

extension=gd for mac extension=php_gd2.dll for windows or ubntu

于 2021-01-26T09:24:35.470 回答