定制 avris/micrus-imagine 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

avris/micrus-imagine

Composer 安装命令:

composer require avris/micrus-imagine

包简介

An image manager for the Micrus framework

README 文档

README

This is a module for Micrus framework that allows you to integrate it with Imagine in a similar way that LiipImagineBundle does in Symfony.

This module lets you define image generators that will automatically apply a set of filters to the specified images and cache the result.

Installation

Run:

composer require avris/micrus-imagine

Then register the module in your App\App:registerModules:

yield new \Avris\Micrus\Imagine\ImagineModule;

Usage

Let's say you want to allow users to attach images to their posts. Whatever they upload, you will save the originals in var/attachments/ folder, but you only want to display it as a 200x200 thumbnail with a watermark in the bottom left corner.

Configure the module in the config/imagine.yml, for instance like that:

source: '%PROJECT_DIR%/var/attachments' # default: '%PROJECT_DIR%/var/pics'
generators:
  thumb:
    thumbnail: { size: [200, 200], mode: outbound }
    watermark: { image: assets/images/logo.png, size: 10%, position: bottomright }

You created a thumb generator that applies two filteres to the original image: thumbnail and watermark.

Now, wherever you wish to display the thumbnail, put such code there:

<img src="{{ post.file|imagine('thumb') }}"/>

It will generate a URL which will point either to a generated image (if it already exists) or to a controller that will generate it.

The built-in list of filters is copied from LiipImagineBundle (MIT).

Extending the module

To create your own filter, just implement Avris\Micrus\Imagine\Filter\LoaderInterface (imagineFilter).

Copyright

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固