yii2-extensions / filepond
FilePond Widget for Yii Framework.
dev-main
2024-12-14 15:59 UTC
Requires
- php: >=8.1
- ext-intl: *
- npm-asset/filepond: ^4.3
- npm-asset/filepond-plugin-file-encode: ^2.1
- npm-asset/filepond-plugin-file-rename: ^1.1
- npm-asset/filepond-plugin-file-validate-size: ^2.2
- npm-asset/filepond-plugin-file-validate-type: ^1.2
- npm-asset/filepond-plugin-image-crop: ^2.0
- npm-asset/filepond-plugin-image-exif-orientation: ^1.0
- npm-asset/filepond-plugin-image-preview: ^4.6
- npm-asset/filepond-plugin-image-transform: ^3.8
- npm-asset/filepond-plugin-pdf-preview: ^1.0
- php-forge/awesome-widget: ^0.1
- ui-awesome/html: ^0.3
- ui-awesome/html-helper: ^0.2
- yiisoft/yii2: *
Requires (Dev)
- maglnet/composer-require-checker: ^4.6
- php-forge/support: dev-main
- phpunit/phpunit: ^10.2
- roave/infection-static-analysis-plugin: ^1.32
- yii2-extensions/phpstan: dev-main
This package is auto-updated.
Last update: 2025-03-14 16:29:35 UTC
README
FilePond.
Installation
The preferred way to install this extension is through composer.
Either run
composer require --dev --prefer-dist yii2-extensions/filepond
or add
"yii2-extensions/filepond": "dev-main"
to the require-dev section of your composer.json
file.
Usage
Name
use Yii2\Extensions\Filepond\FilePond; echo FilePond::widget(['name' => 'image_file']);
Active Field
use Yii2\Extensions\Filepond\FilePond; echo $form ->field($formModel, 'image_file') ->widget( FilePond::class, [ 'loadFileDefault' => $imageFile, 'imagePreviewHeight' => 170, 'imageCropAspectRatio' => '1:1', ], );
Controller or Model
use Yii2\Extensions\Filepond\FileProcessing; $imageFile = FileProcessing::saveWithReturningFile( $categoryForm->image_file, Yii::getAlias('@uploads'), "category{$category->id}", false );
Properties of the widget
Property | Type | Description | Default |
---|---|---|---|
acceptedFileTypes |
string |
The accepted file types. Can be mime types or wild cards. | [] |
allowFileTypeValidation |
bool |
Whether to allow file type validation. | true |
allowFileRename |
bool |
Whether to allow file rename. | false |
allowFileValidateSize |
bool |
Whether to allow file size validation. | true |
allowImageCrop |
bool |
Whether to allow image crop. | false |
allowImageExifOrientation |
bool |
Whether to allow image exif orientation. | true |
allowImagePreview |
bool |
Whether to allow image preview. | true |
allowImageTransform |
bool |
Whether to allow image transform. | false |
allowMultiple |
bool |
Whether to allow multiple files. | false |
allowpdfPreview |
bool |
Whether to allow pdf preview. | false |
cssClass |
string |
The css class of the widget. | '' |
cdn |
boolean |
Whether to use the CDN. | true |
config |
array |
The config of the widget. | [] |
fileRename |
string |
The file rename. | '' |
use: fileRenameFunction: (file) => return my_new_name${file.extension}`; |
|||
fileValidateTypeDetectType |
string |
The file validate type detect type function. | '' |
fileValidateTypeLabelExpectedTypes |
string |
The file validate type label expected types. | '' |
imageCropAspectRatio |
string,null |
The image crop aspect ratio. | null |
imagePreviewHeight |
string,null |
The image preview height. | null |
imagePreviewMarkupShow |
bool |
Whether to show the image preview markup. | true |
imagePreviewMaxFileSize |
string,null |
The image preview max file size. | null |
imagePreviewMaxHeight |
int |
The image preview max height. | 256 |
imagePreviewMaxInstantPreviewFileSize |
int |
The image preview max instant preview file size. | 10000000 |
imagePreviewMinHeight |
int |
The image preview min height. | 44 |
imagePreviewTransparencyIndicator |
string,null |
The image preview transparency indicator. | null |
imageTransformAfterCreateBlob |
array,null |
The image transform after create blob. | null |
imageTransformBeforeCreateBlob |
array,null |
The image transform before create blob. | null |
imageTransformOutputQuality |
int,null |
The image transform output quality. | null |
imageTransformClientTransforms |
array,null |
The image transform client transforms. | null |
imageTransformOutputQualityMode |
string,null |
The image transform output quality mode. | aƱways |
imageTransformOutputStripImageHead |
bool |
The image transform output strip image head. | true |
imageTransformVariants |
array,null |
The image transform variants. | null |
imageTransformVariantsIncludeDefault |
bool |
The image transform variants include default. | true |
imageTransformVariantsDefaultName |
string,null |
The image transform variants default name. | null |
imageTransformVariantsIncludeOriginal |
bool |
The image transform variants include original. | false |
labelIdle |
string |
The label idle. | '' |
labelMaxFileSize |
string |
The label max file size. | '' |
labelMaxFileSizeExceeded |
string |
The label max file size exceeded. | '' |
labelMaxTotalFileSize |
string |
The label max total file size. | '' |
labelMaxTotalFileSizeExceeded |
string |
The label max total file size exceeded. | '' |
labelFileTypeNotAllowed |
string |
The label file type not allowed. | '' |
loadFileDefault |
string |
The load file default. | '' |
maxFiles |
int |
The max files. | 1 |
maxFileSize |
string,null |
The max file size. | null |
maxTotalFileSize |
string,null |
The max total file size. | null |
minFileSize |
string,null |
The min file size. | null |
pluginDefault |
array |
The plugins default. | [ |
FilePondPluginFileValidateType, |
|||
FilePondPluginFileValidateSize, |
|||
FilePondPluginFileValidateType, |
|||
FilePondPluginImageExifOrientation, |
|||
FilePondPluginImagePreview, |
|||
] |
|||
pdfPreviewHeight |
int |
The pdf preview height. | 320 |
pdfComponentExtraParams |
string |
The pdf component extra params. | toolbar=0&view=fit&page=1 |
required |
bool |
Whether the field is required. | false |
Translation support
The extension supports translation. You can translate the extension into your language, for default the extension supports the following languages:
- Chinese
- English
- French
- German
- Poland
- Portuguese
- Russian
- Spanish
Quality code
Support versions Yii2
Testing
Check the documentation testing to learn about testing.
Our social networks
License
The MIT License. Please see License File for more information.