ImageCropper
Based on Croppie JS
Requirements

//expects existing value to be a image file url
//use form-generator hook saveFoo()
ImageCropper::make('Single Image Cropper', 'single_base64')
->width(150)
->height(150)
->square()
->includeExternalScripts() //will only be included once if multiple imageCropper fields.
->thumbnail('w-1/4')
->dropZoneHelp('Drag an image here or click in this area');
//save the image
public function updatedSingleBase64($value)
{
if(filled($value)) {
// $value = png base64 image
// a new image was added, save it
}
if(blank($value)) {
// an existing image has been deleted, remove it from the model and storage
}
}saveFoo() - save the data
Existing files
updatedFoo() - update existing images
Additional methods
->dropZoneHelp(string $text)
->fileInfo(string $text)
->uploadButton(string $text)
->includeExternalScripts()
->thumbnail(string $class)
->width(int $pixels)
->height(int $pixels)
->circle()
->square()
Last updated
Was this helpful?