承接 arisharyanto/laracrop 相关项目开发

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

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

arisharyanto/laracrop

Composer 安装命令:

composer require arisharyanto/laracrop

包简介

Libraries to create crop image function

README 文档

README

Simple crop image Laravel with jCrop

alt crop

How to install

  • Run in your terminal:
$ cd yourprojectdirectory
$ composer require arisharyanto/laracrop
  • Add the service providers in config/app.php:
Arisharyanto\Laracrop\LaracropServiceProvider::class,
  • Run this command in the terminal
$ php artisan vendor:publish --provider="Arisharyanto\Laracrop\LaracropServiceProvider"  
  • Setup the default config in config/laracrop.php
# IMPORTANT! the config which is mark with double asterisk (**) you must change this to something unique after install laracrop because security risk

    'route_prefix' => "laracrop",         # **route prefix to ajax url
    'upload_url' => "upload/image",       # **route url to ajax upload url route_prefix/upload_url
    'path_upload' => "public/filetmp",    # **where you put file upload
    'image_url' => "filetmp",             # **please note you must change this with same url from path_upload exclude "public"

    'aspectratio' => "1",                 # 1 to set ratio same with width and height of image or 
                                          # you can set with custom ratio like 3/1 or 2/1 whatever you want
                                          # set 0 to free crop
                                          
    'minsize' => "[200, 200]",            # Minimum selection size [ width, height ] set 0 to remove min size
    'maxsize' => "[500, 500]",            # Maxium selection size [ width, height ] set 0 to remove max size
    'bgcolor' => "black",                 # Color value for background shading
    'bgopacity' => "0.6"                  # Opacity value for background shading
    'boxwidth' => "600",                  # set image width 
    'boxheight' => "600"                  # set image heigth

How to use

In your blade view

# adding laracrop css set true to embed bootstrap css or set empty the parameters to not embeded
@laracropCss(true)

  # you can add custom setting for some croping 
  @laracrop(name=desktop | aspectratio=1 | minsize=[300, 300] | bgcolor=black | bgopacity=0.7) 
  
  # or you just write with name parameters like this to set default config
  @laracrop(mobile)
  
  # NOTE: name is required

# adding laracrop JS set true to embed jQuery or set empty the parameters to not embeded
@laracropJs(true)

add use Arisharyanto\Laracrop\Laracrop in your Controller

and add this inside your function

  # call this function with parameter $request->input('mobile') from view @laracrop(mobile) will return filename to store in database
  $getName = Laracrop::cropImage($request->input('desktop'));
  
  #call this function at the end of your function to clean temporary file when your uploading image to crop 
  Laracrop::cleanCropTemp();

Credits

License

See the license https://github.com/Aris-haryanto/Laracrop/blob/master/LICENSE

Author

Aris Haryanto visit my website https://arindasoft.wordpress.com/

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 1
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固