marcha/image
Composer 安装命令:
composer require marcha/image
包简介
A forked Laravel 4 to 11. package to aid generating automatically resized images on the fly and generating responsive images.
README 文档
README
A Laravel 4-5 wrapper for the Imagecow image resizing / respoisive image package. See https://github.com/oscarotero/imageCow for more detail on the underlying image manipulation package.
Image cow can use either GD or ImageMagick to transform image.
Instalation
Install as any other Laravel 4 package:
-
Add to composer:
"require": { ... "marcha/image":"dev-master" ... }
-
Composer Update:
$ composer update
-
Add to the providers array in app.php:
'providers' => array( ... 'marcha\Image\Providers\Laravel\ImageServiceProvider')
-
Add to the facades array in app.php:
'aliases' => array( ... 'Image' => 'marcha\Image\Providers\Laravel\Facades\Image')
-
Publish the package config file to change the defaults:
$ php artisan vendor:publish marcha/image
-
Copy the /vendor/imagecow/imagecow/Imagecow/Imagecow.js file to a publicly accessible web directory. The default path is set as /public/js/Imagecow.js, but whatever it is set as in the config the file must exist.
-
Create folder storage/cache/images
Usage
Standard
To provide image links on your templates use like so:
<img src="{{ Image::path('/image.jpg', 'resizeCrop', 400, 200) }}" />
Where the first argument is the image which is referenced from the root of the public directory. The second argument is the transform method and each subsequent argument is an argument that would be passed to the relevant transform method used. See the Imagecow Documentation for more details.
Responsive
To provide links to responsive images use a similar syntax:
<img src="{{ Image::path('/image.jpg', 'resizeCrop', 400, 200)->responsive('max-width=400', 'resize', 100) }}" />
The first argument is the "rule" and the subsequent arguments are the transform conditions to apply to that rule, following the same format. You can apply multiple responsive breakpoints by calling responsive multiple times.
Caching
All images are cached automatically, they are cached to the filesystem in the storage directory, the exact path and lifetime of the cache are configurable in the package config.
marcha/image 适用场景与选型建议
marcha/image 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 101 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 08 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「image」 「resize」 「responsive」 「laravel」 「Laravel 4」 「imagecow」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 marcha/image 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 marcha/image 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 marcha/image 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
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.
ResponsiveImages Plugin for October CMS
TYPO3 extension for sending responsive email templates
Image cache
The lireincore/imgcache integration for the Yii2 framework
统计信息
- 总下载量: 101
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2015-08-04