2017 © Pedro Peláez
 

library laracrop

Libraries to create crop image function

image

arisharyanto/laracrop

Libraries to create crop image function

  • Tuesday, February 20, 2018
  • by Aris-haryanto
  • Repository
  • 1 Watchers
  • 2 Stars
  • 28 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 12 % Grown

The README.md

Laracrop

Simple crop image Laravel with jCrop, (*1)

alt crop, (*2)

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, (*3)

# 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, (*4)

and add this inside your function, (*5)

  # 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, (*6)

Author

Aris Haryanto visit my website https://arindasoft.wordpress.com/, (*7)

The Versions

20/02 2018

dev-master

9999999-dev https://github.com/Aris-haryanto/Laracrop

Libraries to create crop image function

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

photo crop laracrop photocrop

03/01 2018

1.0.3

1.0.3.0 https://github.com/Aris-haryanto/Laracrop

Libraries to create crop image function

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

photo crop laracrop photocrop

29/12 2017

1.0.2

1.0.2.0 https://github.com/Aris-haryanto/Laracrop

Libraries to create crop image function

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

photo crop laracrop photocrop

18/10 2017

1.0.1

1.0.1.0 https://github.com/Aris-haryanto/Laracrop

Libraries to create crop image function

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

photo crop laracrop photocrop

18/10 2017

1.0.0

1.0.0.0 https://github.com/Aris-haryanto/Laracrop

Libraries to create crop image function

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

photo crop laracrop photocrop