1. Go to this page and download the library: Download vipertecpro/image-cropper 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/ */
vipertecpro / image-cropper example snippets
use Native\Mobile\Attributes\On;
use Native\Mobile\Edge\NativeComponent;
use Vipertecpro\ImageCropper\Events\CropCancelled;
use Vipertecpro\ImageCropper\Events\ImageCropped;
use Vipertecpro\ImageCropper\Facades\ImageCropper;
class Avatar extends NativeComponent
{
public ?string $photo = null; // an existing image path
public ?string $cropped = null;
public function crop(): void
{
ImageCropper::open($this->photo, ['preset' => 'profile']); // circular avatar
}
#[On(ImageCropped::class)]
public function onCropped(string $path): void
{
$this->cropped = $path; // a brand-new cropped file on disk
}
#[On(CropCancelled::class)]
public function onCancelled(): void
{
// user backed out — nothing produced
}
}
// Crop an image that lives on your CDN/API — the plugin downloads it
// natively (themed loading screen with Cancel), then opens the editor:
ImageCropper::open('https://cdn.example.com/avatars/current.jpg', ['preset' => 'profile']);