承接 encoda/ss-image-min 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.

统计信息

  • 总下载量: 88
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-15