PHP code example of vojtys / croppie

1. Go to this page and download the library: Download vojtys/croppie library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vojtys / croppie example snippets



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; 
}