wernerdweight/image-manager-bundle
Composer 安装命令:
composer require wernerdweight/image-manager-bundle
包简介
Support for image resizing, cropping and encrypting for Symfony.
README 文档
README
This bundle adds support for image resizing and cropping.
Installation
- Download using composer
{ "require": { "wernerdweight/image-manager-bundle": "~3.0" } }
- Enable the bundle
Enable the bundle in your kernel:
<?php // config/bundles.php return [ // ... WernerDweight\ImageManagerBundle\WDImageManagerBundle::class => ['all' => true], ];
- Setup config
# config/packages/wd_image_manager.yaml wd_image_manager: upload_root: absolute/path/to/web/directory # typically %kernel.root_dir%/../web upload_path: relative/path/for/storing/images # e.g. uploads/images secret: thisIsNotSecret # you can use app secret (%secret%) or any other custom secret (needed for encryption) autorotate: true # default false (if true, an attempt will be made to automatically rotate images based on exif data) 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
How to use:
// this example expects you to pass image manager via DI into $imageManager // upload your image file(s), create database records etc. ... // process image (one by one) // 1st parameter ($file) is instance of Symfony\Component\HttpFoundation\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 = $imageManager->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.
wernerdweight/image-manager-bundle 适用场景与选型建议
wernerdweight/image-manager-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 124 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 02 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「image」 「resize」 「crop」 「encrypt」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 wernerdweight/image-manager-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wernerdweight/image-manager-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 wernerdweight/image-manager-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A bundle providing fields for image upload with jquery upload and image cropping with jcrop for symfony2
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
Image cache
A image cropping field for kirby.
The lireincore/imgcache integration for the Yii2 framework
统计信息
- 总下载量: 124
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-08