encoda/ss-image-min
Composer 安装命令:
composer require encoda/ss-image-min
包简介
SilverStripe Image Compress and Cache module
README 文档
README
SS-image-min is a Silverstripe module for image compressing and server-side caching based on nielse63/php-image-cache.
Requirements
SilverStripe Framework 3.0+
Installation
After installing the module by any of the following methods you must build you database by visiting http://yoursite.com/dev/build.
Composer
Create a composer.json file:
{
"require" : {
"encoda/ss-image-min": "~0.1.3"
}
}
Navigate to your project root and run the install command.
$ composer install
Github
Navigate to the root directory of your SilverStripe application and execute git clone https://github.com/encoda/ss-image-min.git
Manually
Download this zip file and extract it in your SilverStripe root directory.
Usage
Once the module is installed, a compressed cache version of each Silverstripe Image instance file is automatically generated by the time it is saved in the database, or (if the module is lately installed in the application and there are already several images in the database) individually at the moment the URL of any of them is called directly or indirectly, by calling either one of its following methods: getTag, getUrl or getAbsoluteURL.
Example
mysite/code/NarcissisticTeenager.php
<?php NarcissisticTeenager extends DataObject { ... private static $many_many = array( 'Selfies' => 'Image', ); public function FirstSelfie() { return $this->Selfies()->First(); } ... }
themes/autinpack/templates/Page.ss
<% with $SomeNarcissisticTeenager %>
<% loop $Selfies %>
$GetTag
<% end_loop %>
<% end_with %>
Configuration
SS-image-min doesn't require any configuration.
Although you can overwrite some of them through your _config.php.
Compress Rate
Default: 80
<?php
SSImageCache::$compress_rate = 70;
Increasead Memory Limit
Generating compressed images uses a lot more than the PHP is normally allowed to use. So, by default, SS-image-min increases its memory limit temporarily during the compression processes.
Default: '2480M'
<?php
SSImageCache::$increased_memory_limit = '128M';
Cached Image Directory
Change the directory where the generated cached images are saved into.
Default: 'ASSETS_PATH . /cache/images'
<?php
SSImageCache::$image_directory = '/home/user/workspace/project/assets/cached_images';
Important: The chosen directory must have write rights.
License (MIT)
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
encoda/ss-image-min 适用场景与选型建议
encoda/ss-image-min 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 88 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 01 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「image」 「cache」 「compress」 「silverstripe」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 encoda/ss-image-min 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 encoda/ss-image-min 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 encoda/ss-image-min 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
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
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
OriginPHP Html
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
Laravel 5 - Repositories to the database layer
统计信息
- 总下载量: 88
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-15