vojtys/croppie

Croppie (Foliotek/Croppie) for Nette - Forms

Installs: 1 926

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Language:JavaScript

v0.2 2020-03-22 14:41 UTC

This package is auto-updated.

Last update: 2024-10-23 01:31:05 UTC


README

Foliotek/Croppie control for Nette framework

Install

$ composer require vojtys/croppie

Versions

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>