carbon/vips
Composer 安装命令:
composer require carbon/vips
包简介
Enable Vips in your Neos CMS installation
README 文档
README
Carbon.Vips: Blazing fast image processing for Neos and Flow
Your Neos website or Flow application usually uses ImageMagick and GD for rendering smaller versions of your photos, or previews of other media assets. While these libraries are quite powerful, they need a big amount of memory for processing images. It can easily happen for a Neos page with a lot of thumbnails to consume hundreds of Megabytes of RAM to create the respective image files. When the original assets are rather large or you need to process animated GIFs, you might even need Gigabytes of RAM just for rendering that page.
Many hoster and Docker images provides libvips, a low-level code library which can do almost the same things like ImageMagick, but much faster and with a relatively small memory footprint.
It is recommended that you configure all your Flow and Neos projects to use Vips instead of ImageMagick.
Before you start
When you enable Vips for your project, you will also need Vips support in your development environment.
The reason for that is, that you need to be able to run composer update. The package which provides Vips support (rokka/imagine-vips) has a dependency on the vips PHP extension, and if you don't have that extension enabled, Composer will complain about non fulfilled platform requirements.
The solution is easy though: just install PHP Vips for your local environment. Make sure though, that everybody in your team who runs composer update also has Vips installed.
Installing PHP Vips for your development environment
ddev
Just add following line to your ddev config.yaml file:
webimage_extra_packages: - php8.1-vips
After you added this, you can restart your container with ddev restart and you are ready to go!
Note: Please set the correct PHP version for the vips package
Local installation
For your development environment you need to install two libraries:
- a Vips library for your operating system
- a PHP extension which provides bindings to that low-level library
The installation process is explained on the php-vips-ext project site on Github. As an example, if your development system is a Mac and you are using Homebrew as a package manager the installation steps are as follows:
First install the libvips system library:
brew install vips
Next, install the php-vips extensions. This extension is installed via PECL and which will compile the library specifically for your current PHP version:
pecl install vips
When everything's working fine, you should be able to see vips in the list of enabled PHP modules when you're running
php -m from the command line.
If that does not list vips, you need to enable the extension in your PHP configuration, for example by creating a new
file ext-vips.ini in your PHP's conf.d/ folder:
extension=vips.so
Note
Many parts of this readme are taken from Flownative's blog entry about vips.
carbon/vips 适用场景与选型建议
carbon/vips 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.59k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 12 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 carbon/vips 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 carbon/vips 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-09