我在 GitHub 上找到了一个用 php 提取图像颜色的类。首先,我确实创建了一个 php 文件并将这些行添加到文件中:
require_once 'ColorThief.php';
$sourceImage = '1.jpg';
use ColorThief\ColorThief;
$palette = ColorThief::getPalette($sourceImage, 8);
但问题是我收到了这个错误信息,我不知道如何解决它:
Fatal error: Class 'ColorThief\Image\ImageLoader' not found in C:\UwAmp\www\ColorThief\ColorThief.php on line 182
Call Stack
# Time Memory Function Location
1 0.0002 133416 {main}( ) ...\show.php:0
2 0.0038 198232 ColorThief\ColorThief::getPalette( ) ...\show.php:9
3 0.0038 198440 ColorThief\ColorThief::loadImage( ) ...\ColorThief.php:140
你们知道我如何使用这门课吗?GitHub页面:
使用 Composer 安装 Color Thief,这是在您的项目中使用 3rd 方库的标准。
gd (php_gd2.dll) - http://php.net/manual/en/image.installation.php
imagick (php_imagick.dll) - http://php.net/manual/en/imagick.setup.php
作曲家需要 ksubileau/color-thief-php
require_once 'vendor/autoload.php';
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句