Download the PHP package mberecall/kropify-laravel without Composer

On this page you can find all versions of the php package mberecall/kropify-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package kropify-laravel

!['Kropify'](img/kropify.png)

![GitHub release](https://img.shields.io/github/v/release/mberecall/kropify-laravel) GitHub code size in bytes [![Total Downloads](https://poser.pugx.org/mberecall/kropify-laravel/downloads)](https://packagist.org/packages/mberecall/kropify-laravel) [![Package License](https://img.shields.io/badge/License-MIT-brightgreen.svg)](LICENSE) GitHub Org's stars

Kropify

Irebe Library brought you easy cropping image tool for user profile picture, cover image, etc... that can be integrated into Laravel project.

NOTE: Kropify cannot be integrated into Laravel framework only. It has another php version that can be integrated into CodeIgniter and Core PHP projects.

What is a Kropify?

A Kropify is a tool that can be integrated into Laravel framework, CodeIgniter framework and Core PHP projects for the purpose of giving users easy way to crop their profile pictures and covers. It uses JQuery 3.x library in it's functionality as dependency. That's why it is important to include JQuery library on current blade file.

Requirements

Installation

This package can be installed through composer require. Before install this, make sure that your are working with PHP >= 7.2 in your system. Just run the following command in your cmd or terminal:

  1. Install the package via Composer:

    The package will automatically register its service provider if your Laravel framework is 8.x or above. And also, If Image Intervention package was not installed before, This package will install Image Intervention package to your Laravel project.

  2. Optionally, After you have installed Kropify, open your Laravel config file config/app.php and add the following lines.

    In the $providers array, add the service providers for this package.

  3. After Kropify package installed, you need to publish its css and js minified files in Laravel public folder by running the following command in terminal:

Updating Package

When new Kropify version released and try to update the current package to the latest version, you will need to use composer update command:

When package not updated by using the above command, use below command that will remove current package version and install new version of package.

After Kropify package updated, you need also to update its assets (css and js minified files) by running the following command in terminal:

For Kropify directives, you have to run this command to get immediately changes in views.

Finally, It is neccessary to run the following command to autoload package files.

#

Usage

This package uses css and js minified files, that is why you first need to include this package assets on your blade file. Place the following directive inside <head> tag of your blade file to including Kropify css file on page.

NOTICE: Don't forgot to add CSRF meta tags to every blade file included Kropify assets as shown in above example.

For Kropify Js file, you need to add the following directive or helper inside <body> tag but before closing </body> tag after including JQuery as shown in below example.

Package initialization

Suppose that you have an input file on your form for user profile picture:

Routes

When you want to initiate Kropify on that particular input file, you will use the following scripts.

Options

Option Default Description
viewMode 1 You can set this value to (1,2 or 3). But you can not add this option if you are happy with the default value which is 1.
aspectRatio 1 You can add your custom cropped image ratio. You can use fractional numbers and float numbers. eg: 16/4, 10/32, 0.25, 2.25, etc...
preview required This option is very required, This is where you define the output to preview the cropped image. Here, you must use jquery selector to select id="" or class="" of the element. We recommended to use <span> or <div> tags.
cancelButtonText Cancel You can change this button text with your need and according to your language.
resetButtonText Reset You can change this button text with your need and according to your language.
cropButtonText Crop You can change this button text with your need and according to your language.
maxSize 2097152 By default, this value set to the maximum size of 2MB .But, you can set your own maximum size of selected image.
processURL - This option is very required. You must define your url of croping selected image. eg: processURL : "{{ route('crop') }}" or processURL : "{{ url('crop') }}"
showLoader true If you want to display loading element when user croping the selected image, you can set this option to true. But if you do not want that loading element appears on page, set this option to false.

Errors callback

This callback has two arguments, error and text

Parameter Description
error This prameter will return two types of errors invalidFileType and bigFileSize. You can make a if condition according to the returned error type.
text You can alert this value eg: alert(message);. If you are using Toastr.js plugin, You may use toastr.error(text)' function to display error alert.

In controller

To include Kropify class in controller is very simple. Just import the following lines on your controller.

To upload the cropped image you will use the following lines inside method:

The above lines will upload the cropped image in the specified path. The cropped image can be uploaded in Laravel public folder or in Laravel storage folder. Very important function on the chain is maxWoH(). This function will limit maximum dimensions (Width or Height) in px value of the uploaded image. If you do not need to compress and resize the cropped image, just do not add maxWoH() to the Kropify upload function chain. Make sure that extension=gd extension is enable in your server.

Get Cropped/Uploaded image details

When cropped image uploaded successfully, you can get the uploaded image information like name, size, width and Height. You can use these details when you need to store them into database. Below are examples of getting uploaded image details:

Not supported

1. Currently, uploading cropped image using Laravel Livewire is not supported. This package still in development, Once uploading cropped image in Laravel Livewire available, we will notify you. You can not also upload image to AWS Amazon S3.

2. This package is still in development, that is why you can not make two or more instances on single page of this jquery scripts part.


Copyright and License

kropify-laravel was written by MB'DUSENGE Callixte (mberecall) and is released under the MIT License.

Copyright (c) 2023 - Irebe Library


All versions of kropify-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
intervention/image Version ^2.7
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mberecall/kropify-laravel contains the following files

Loading the files please wait ....