vysotsky-productions / nova-photo-field
A Laravel Nova field.
Installs: 94
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Language:Vue
Requires
- php: >=7.2
This package is auto-updated.
Last update: 2025-03-01 00:22:44 UTC
README
##installation
composer require vysotsky-productions/nova-photo-field php artisan vendor:publish --tag=nova-photo-field
NovaPhotoField::make('Превью', 'preview')
->aspectRatio(3/4)
->getPhoto('original_url')
->getPhotoForm('preview_url')
->getPhotoDetail('preview_url')
->getPhotoIndex('preview_url')
->getCropBoxData('crop_data')
->setDeletable(false)
->setHandler(
new SavePhoto('persons/avatar', config('thumbs.user.persons/avatar'))
),
####getPhoto(string $original_url)
$original_attribute - attribute name for original url of Media instance
####getPhotoForm(string $preview_url)
$original_attribute - attribute name for cropped url of Media instance
####getPhotoDetail(string $preview_url)
$original_attribute - attribute name for preview url of Media instance
####getPhotoIndex(string $preview_url)
$original_attribute - attribute name for preview url of Media instance
####getCropBoxData(string $crop_data)
$original_attribute - attribute name for crop_data of Media instance
####setHandler($handlerClass)
$handlerClass should implement 3 methods:
save :: $file, $cropData -> new Media
update :: $mediaId, $cropData -> void
delete :: $mediaId -> void
####setDeletable(bool $deletable)
by default - true (it means that file will be deleted with
$handlerClass delete method)