moc/imageoptimizer
Composer 安装命令:
composer require moc/imageoptimizer
包简介
Flow package that optimizes generated thumbnail images (jpg, png, gif, svg) for web presentation.
README 文档
README
Introduction
Neos CMS / Flow framework package that optimizes generated thumbnail images (jpg, png, gif, svg and more) for web presentation.
Original files are never affected since copies are always created for thumbnails.
Non-blocking during rendering (asynchronous) optimization.
Using jpegtran, optipng, gifsicle and svgo or alternative customizible ones for the optimizations.
Should work with Linux, FreeBSD, OSX, SunOS & Windows (only tested Linux & FreeBSD so far).
Compatible with Neos 1.x - 5.x / Flow 1.x - 6.x
Only supports local file system (no CDN support yet) (see #10)
Installation
Requires npm (node.js) to work out of the box, although binaries can also be installed manually without it.
composer require "moc/imageoptimizer" "~4.0"
Ensure the image manipulation libraries jpegtran (JPG), optipng (PNG), gifsicle (GIF) and svgo (SVG) are installed globally. Libraries can be skipped if desired, just make sure to disable those mimetypes.
Alternatively install them using npm:
# Globally
npm install -g jpegtran-bin optipng-bin gifsicle svgo
# Locally
npm install --prefix Packages/Application/MOC.ImageOptimizer/Resources/Private/Library
Configuration
Using the Settings configuration, multiple options can be adjusted.
Optimization can be disabled for specific file formats.
Additionally options such as optimization level (png & gif), progressive (jpg), pretty (svg) can be adjusted depending on optimization library.
Usage of global available binaries can be configured instead or for specific formats.
Enable using the setting MOC.ImageOptimizer.useGlobalBinary and configure the path in MOC.ImageOptimizer.globalBinaryPath.
Use alternative libraries for optimization
You can replace the preconfigured libraries with alternative ones.
Example:
Add the following to your Settings to use jpegoptim instead of jpegtran:
MOC:
ImageOptimizer:
formats:
'image/jpeg':
enabled: true
library: 'jpegoptim'
binaryPath: 'jpegoptim-bin/vendor/jpegoptim'
arguments: "${'--strip-all --max=' + quality + ' ' + (progressive ? '--all-progressive ' : '') + '-o ' + file}"
parameters:
progressive: true # whether or not to serve progressive jpgs
quality: 80 # quality level (1-100)
When doing this you have to take care that you provide the necessary library yourself as it's not included when doing the installation like described above.
Usage
- Clear thumbnails to generate new ones that will automatically be optimized.
./flow media:clearthumbnails
- See system log for debugging and error output.
moc/imageoptimizer 适用场景与选型建议
moc/imageoptimizer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 109.59k 次下载、GitHub Stars 达 30, 最近一次更新时间为 2015 年 03 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「flow」 「performance」 「media」 「images」 「Neos」 「imageoptimization」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 moc/imageoptimizer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 moc/imageoptimizer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 moc/imageoptimizer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
g4 application profiler package
CSS/Javascript Minificator, Compressor and Concatenator for TYPO3 - highly configurable frontend asset optimization for CSS/JS merging, minification and compression with optional body parsing, async/defer loading, inline output, data-ignore exclusions, SRI integrity validation/calculation, external
WordPress mu-plugin to remove jQuery Migrate from the list of jQuery dependencies and to allow jQuery to enqueue before </body> instead of in the <head>.
Put images nicley in a row
Simple Sharing generates social media share links within CP entry pages, allowing you to quickly & easily share entries.
Create link to static resources with cache-breaking segment based on md5 of the file
统计信息
- 总下载量: 109.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 31
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-22