承接 haunt-jonathan/image-cropper 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

haunt-jonathan/image-cropper

最新稳定版本:1.0

Composer 安装命令:

composer require haunt-jonathan/image-cropper

包简介

CitaNZ's image cropper for SilverStripe 4, with versioning

README 文档

README

It's a continious development of Salted Herring's Cropper Field for SilverStripe - 4 (https://github.com/salted-herring/salted-cropper)

Usage

  1. Install
composer require haunt-jonathan/image-cropper
  1. /dev/build?flush=all

  2. Sample code:

    ...
    use Cita\ImageCropper\Model\CitaCroppableImage;
    use Cita\ImageCropper\Fields\CroppableImageField;
    ...
    private static $has_one = array(
        'Photo'     =>  CitaCroppableImage::class
    );
    
    
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        ...
        // adding a free cropper
        $fields->addFieldToTab(TAB_NAME, CroppableImageField::create('PhotoID', A_TITLE_TO_THE_FILED));
    
        // adding cropper with ratio
        $fields->addFieldToTab(TAB_NAME, CroppableImageField::create('PhotoID', A_TITLE_TO_THE_FILED)->setCropperRatio(16/9));
        ...
        return $fields;        
    }
  3. Add image > upload/select > save > edit > do your cropping > save

  4. Output

    $Photo
    $Photo.Cropped
    $Photo.Cropped.SetWidth(100)

AWS support

If you are using SS's S3 assets module to store your images, you may also want to add this into your site's config yaml

SilverStripe\Admin\LeftAndMain:
  extra_requirements_javascript:
    - 'resources/vendor/haunt-jonathan/image-cropper/client/js/s3-workaround.js'

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-13