Skip to content
Foliotek/Croppie form control for Nette framework
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
src
.gitattributes
.gitignore
README.md
composer.json

README.md

Foliotek/Croppie

Foliotek/Croppie control for Nette framework

Install

$ composer require vojtys/croppie

Configuration

NEON - add extension

extensions:
    croppie: Vojtys\Forms\Croppie\CroppieExtension

croppie:
    width: 300
    height: 300

Usage

Presenter/Control


/**
 * @return Nette\Application\UI\Form
 */
public function createComponentTestForm()
{
    $form = new Nette\Application\UI\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>
You can’t perform that action at this time.