定制 wernerdweight/microbe-image-manager 二次开发

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

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

wernerdweight/microbe-image-manager

Composer 安装命令:

composer require wernerdweight/microbe-image-manager

包简介

Support for image resizing, cropping and encrypting for Microbe.

README 文档

README

This utility adds support for image resizing and cropping to Microbe.

Installation

  1. Download using composer
	{
		"require": {
			"wernerdweight/microbe-image-manager": "~2.0"
		}
	}
  1. Setup config
# app/config/microbe.yml
wd_image_manager:
	enabled: true
    upload_root: path/to/web/directory # public/uploads
    upload_path: relative/path/for/storing/images # e.g. images/image-manager
    secret: thisIsNotSecret # you can use app secret (%secret%) or any other custom secret (needed for encryption)
    versions:
        version_name_x:	# this key will be used as name of directory to where this version of images will be saved
            width: 200	# desired image width in pixels (if you ommit width or height image will keep its original dimensions)
            height: 200 # desired image height in pixels (if you ommit width or height image will keep its original dimensions)
            crop: true	# set this to true if you want the resulting image to have EXACTLY the dimensions specified (default false)
            watermark: # if you don't want your images to be watermarked, do not set this key at all
                file: absolute/path/to/watermark/file # e.g. %kernel.root_dir%/../web/watermark.png
                size: 50 # css-like watermark size; possible values: cover/contain/percentage (integer 0 - 100)
                position:
                    top: 50 # css-like position from top in percent (integer 0 - 100; default 100 - align to bottom)
                    left: 50 # css-like position from left in percent (integer 0- 100; default 100 - align to right)
        encrypted_version_name:
            encrypted: true	# if encrypted is set to true original image will be saved encrypted (intended for image download restrictions)
        ...
            

Usage

Code to be used inside a controller:

		/// get manager
		$im = $this->kernel->service('imageManager');
		
		/// upload your image file(s), create database records etc.
		...

		/// process image (one by one)
		/// 1st parameter ($file) is instance of WernerDweight\MicrobeImageManager\File\UploadedFile (mandatory)
		/// 2nd parameter is the filename of newly created file (mandatory)
		/// 3rd parameter is a path under upload_path from config (optional)
		$processedImageInfo = $im->processImage($file,'destination-filename','/optional/subpath');

License

This bundle is under the MIT license. See the complete license in the root directiory of the bundle.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固