ctessier/nova-advanced-image-field 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

ctessier/nova-advanced-image-field

Composer 安装命令:

composer require ctessier/nova-advanced-image-field

包简介

An advanced image field for Nova with cropping and resizing.

README 文档

README

StyleCI Latest Version on Packagist Total Downloads License

An advanced image field for Nova allowing you to upload, crop and resize images

This package is built on top of the native Nova image field. It uses Advanced Cropper to show a cropper on the frontend, and Intervention Image to process the image on the backend.

screenshot of the advanced image field

Requirements

Version PHP Nova GD (default) Imagick
1.x >=7.1 2 or 3 >=2.0 >=6.5.7
2.x >=7.3 4

See Intervention requirements for more details.

Getting started

Install the package into a Laravel application with Nova using Composer:

composer require ctessier/nova-advanced-image-field

If you want to use Imagick as the default image processing library, follow the Intervention documentation for Laravel. This will provide you with a new configuration file where you can specify the driver you want.

Code examples

AdvancedImage extends from Image so you can use any methods that Image implements. See the documentation here.

// Show a cropbox with a fixed ratio
AdvancedImage::make('Photo')->croppable(16/9),

// Resize the image to a max width
AdvancedImage::make('Photo')->resize(1920),

// Override the image processing driver for this field only
AdvancedImage::make('Photo')->driver('imagick'),

To display the image as a rounded avatar, use the AdvancedAvatar class or the rounded method:

AdvancedAvatar::make('Avatar')->croppable(),
AdvancedImage::make('Avatar')->croppable()->rounded(),

API

driver(string $driver)

Override the default driver to be used by Intervention for the image manipulation.

AdvancedImage::make('Photo')->driver('imagick'),

croppable([float $ratio])

Specify if the underlying image should be croppable.

If a numeric value is given as a first parameter, it will be used to define a fixed aspect ratio for the crop box.

AdvancedImage::make('Photo')->croppable(),
AdvancedImage::make('Photo')->croppable(16/9),

resize(int $width = null[, int $height = null])

Specify the size (width and height) the image should be resized to.

AdvancedImage::make('Photo')->resize(1920),
AdvancedImage::make('Photo')->resize(600, 400),
AdvancedImage::make('Photo')->resize(null, 300),

Note: this method uses Intervention Image resize() with the upsize and aspect ratio constraints.

autoOrientate()

Specify if the underlying image should be orientated. It will rotate the image to the orientation specified in Exif data, if any.

This can be mandatory in some cases for the cropper to work properly.

AdvancedImage::make('Photo')->autoOrientate(),

Note: PHP must be compiled in with --enable-exif to use this method. Windows users must also have the mbstring extension enabled. See the Intervention Image documentation for more details.

quality(int $quality)

Specify the resulting quality of the transformed image.

This only applies to JPG format as PNG compression is lossless. The value must range from 0 (poor quality, small file) to 100 (best quality, big file).

AdvancedImage::make('Photo')->resize(600, 400)->quality(95),

Note: the quality will be passed to the Intervention Image save() method.

convert(string $format)

Specify the desired output format.

AdvancedImage::make('Photo')->convert('webp'),

Note: See Intervention Image encode() for more details, including the list of allowed formats.

ctessier/nova-advanced-image-field 适用场景与选型建议

ctessier/nova-advanced-image-field 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 567.66k 次下载、GitHub Stars 达 103, 最近一次更新时间为 2018 年 11 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「image」 「nova」 「resize」 「image resize」 「laravel」 「crop」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 ctessier/nova-advanced-image-field 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ctessier/nova-advanced-image-field 我们能提供哪些服务?
定制开发 / 二次开发

基于 ctessier/nova-advanced-image-field 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 567.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 103
  • 点击次数: 30
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 103
  • Watchers: 4
  • Forks: 30
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-28