Componette

Componette

vojtys

vojtys / croppie v0.2

Foliotek/Croppie form control for Nette framework 3.0

download-cloud-line composer require vojtys/croppie

Foliotek/Croppie

Foliotek/Croppie control for Nette framework

Install

$ composer require vojtys/croppie

Versions

State Version Branch Nette PHP
stable v0.2 master 3.0+ >=7.1
stable v0.1 master 2.4 >=5.6

Configuration

NEON - add extension

extensions:
    croppie: Vojtys\Forms\Croppie\CroppieExtension

croppie:
    width: 300
    height: 300
    enableExif: true
    type: square
    size: original

Usage

public function createComponentTestForm(): Form
{
    $form = new Form();

    $form->addCroppie('image', 'Vybrat obrázek z počítače');
    $form->addSubmit('ok', 'Nahrát obrázek')->getControlPrototype()->class('upload-btn');
    $form->onSuccess[] = [$this, 'imageUploadProcess'];

    return $form;
}

public function imageUploadProcess(Form $form, $values)
{
    /** @var Vojtys\Forms\Croppie\Image $image **/
    $image = $values->image; 
}

CSS

<link rel="stylesheet" type="text/css" href="./assets/css/croppie.css">
<link rel="stylesheet" type="text/css" href="./assets/css/vojtys.croppie.css">

JavaScript

Before </body> element.

<script src='./assets/js/croppie.js'></script>
<script src='./assets/js/vojtys.croppie.js'></script>
  • v0.2 v0.2

    • better configuration
  • v0.1 v0.1

price-tag-2-line

Badges

guide-fill

Dependencies

php (>= 5.4)
nette/di (>=2.4.0)
nette/forms (>=2.4.0)
nette/utils (>=2.4.0)
Componette Componette felix@nette.org