Download the PHP package mix8872/files-attacher without Composer
On this page you can find all versions of the php package mix8872/files-attacher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package files-attacher
Files attacher module for Yii2 [deprecated]
Files attacher module for attache any files to the your models.
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require
section of your composer.json
.
Then you must run migration by running command:
yii migrate --migrationPath=@vendor/mix8872/files-attacher/src/migrations
Configure
To configure module please add following to the modules section of common main config:
Common:
In config you may define access control to prevent access to the administrative part of the module.
Also you can define imageResize
to create additional sizes for uploaded images.
In imageResize
definitions, also you can optionally define model for which scaling will be applied. Support definition several models as array.
To use sizes names template you may define sizesNameTemplate
option, where %k
- key, %s
- size. By default - %s
;
If origResize
option defined original image size will be changed. Also you can define models array;
Also you can change image driver to imagick.
By define filesNameBy
option you may change files naming style from random string to translit file name, also you can define model
attribute too.
For changing default save path you can define savePath
option. The path will be considered from the web directory.
Usage
Using the module is available as a widget and behavior for the model.
First, you must configure the behavior of the required models in this way:
In tags attribute you may define tags for attach files, if you define same tags in delteOld attribute then files loaded with this tags will be rewritten by newly added files.
Next you may add widget model and echo widget with its config:
IMPORTANT ! you may define multipart/form-data enctype in you form!
You can get the model files by calling the method:
public function getFiles(string $tag, bool $single, bool $asQuery)
$tag - tag of you attachment $single - if true - returns single attachment object $asQuery - if tru - returns ActiveQuery object
All versions of files-attacher with dependencies
ext-mbstring Version *
ext-intl Version *
intervention/image Version *
himiklab/yii2-sortable-grid-view-widget Version *