GithubHelp home page GithubHelp logo

cropper's Introduction

cropper extension for laravel-admin

这是一个laravel-admin扩展,用来将cropper集成进laravel-admin的表单中

截图

安装

composer require laravel-admin-ext/cropper

然后

php artisan vendor:publish --tag=laravel-admin-cropper

配置

config/admin.php文件的extensions,加上属于这个扩展的一些配置

    'extensions' => [

        'cropper' => [
        
            // 如果要关掉这个扩展,设置为false
            'enable' => true,
        ]
    ]

使用

在form表单中使用它:

$form->cropper('content','label');

默认模式是自由剪裁模式,如果需要强制剪裁尺寸,请使用(注意该尺寸就是最后得到的图片尺寸 非“比例”)

$form->cropper('content','label')->cRatio($width,$height);

PS (特性预读)

1、图片并不是预上传的,而是前端转base64之后填入input,服务端再转回图片保存的

2、图片格式是默认原格式保存的。就是说,如果原图是透明底色的png图片,保存之后仍旧是透明底色的png图片,并不会损失(前端logo神器)

3、该扩展是可多次调用的。在同一个表单内能调动多次,不会相互干扰。

4、扩展继承了laravel-admin 的ImageField类 和File类。 所以你不必去纠结图片的修改 和删除问题。他们都是自动操作的。 当然,因为继承了ImageField类,所以也能使用 “intervention/image” 的各种(crop,fit,insert)方法 (前提是你已经composer require intervention/image)

License

Licensed under The MIT License (MIT).

cropper's People

Contributors

eva09 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.