biffbangpow/silverstripe-imagesize-validator 问题修复 & 功能扩展

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

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

biffbangpow/silverstripe-imagesize-validator

最新稳定版本:v1.0.0

Composer 安装命令:

composer require biffbangpow/silverstripe-imagesize-validator

包简介

Validates the dimensions of an image during upload

README 文档

README

This extends the standard upload validator and provides additional checks on the dimensions of an uploaded image.

The validator can be applied directly to an uploadfield:

    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $fields->addFieldsToTab('Root.Main', [
            UploadField::create('Image')->setValidator(PixelSizeValidator::create()),
        ]);

        return $fields;
    }

Note: the validator should only be added to upload fields where the underlying class is an Image or subclass thereof. Adding the validator to an upload field where files may be uploaded will cause any non-images to be rejected.

By default the validator will reject an image which has a pixel dimension greater than 2000 in either axis. This can be overidden in yml config, eg:

---
Name: bbppixelsizevalidator
---

BiffBangPow\Validators\PixelSizeValidator:
  max_width: 2500
  max_height: 1200

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-08-31