2017 © Pedro Peláez
 

yii-module yii-file-processor

image

metalguardian/yii-file-processor

  • Wednesday, February 4, 2015
  • by MetalGuardian
  • Repository
  • 0 Watchers
  • 3 Stars
  • 852 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Install

in config/main.php:, (*1)

    Yii::setPathOfAlias('fileProcessor', '/path/to/extension/');

example for standard yii structure when this module located in extension dir:, (*2)

    Yii::setPathOfAlias('fileProcessor', dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR . 'yii-file-processor' . DIRECTORY_SEPARATOR . 'fileProcessor');

application config:, (*3)

    ...
    'controllerMap' => array(
        'image' => array(
            'class' => '\fileProcessor\controllers\ImageController',
        ),
    ),
    ...

if you merge main config with console config, you need unset controllerMap key, (*4)

modules section:, (*5)

    'file-processor' => array(
        'baseDir' => realpath(
                __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'www'
            ) . DIRECTORY_SEPARATOR,
        'imageSections' => array(
            'admin' => array(
                'default' => array(
                    'width' => 100,
                    'height' => 100,
                    'quality' => 100,
                    'do' => 'resize', // resize|adaptiveResize
                ),
            ),
        ),
        'imageHandler' => array(
            'driver' => '\fileProcessor\extensions\imageHandler\drivers\MDriverGD',
            // '\fileProcessor\extensions\imageHandler\drivers\MDriverImageMagic'
        ),
    ),

component section:, (*6)

    'urlManager'=>array(
        ...
        'rules'=>array(
            ...
            array(
                'class' => '\fileProcessor\components\YiiFileProcessorUrlRule',
                'connectionId' => 'db',
                'cacheId' => 'cache',
                'controllerId' => 'image',
            ),
            // controllerId - name of the controller, which you set in controller map
            ...
        ),
    ),

add behavior to the model:, (*7)

    'fileBehavior' => array(
        'class' => '\fileProcessor\components\FileUploadBehavior',
        'attributeName' => 'file_id',
        'fileTypes' => 'png, gif, jpeg, jpg',
    ),

Run command:, (*8)

    php protected/yiic.php migrate --migrationPath=application.extensions.yii-file-processor.fileProcessor.migrations

The Versions

04/02 2015

dev-master

9999999-dev https://github.com/MetalGuardian/yii-file-processor

  Sources   Download

MIT

by Ivan Pushkin

file extension upload module yii

03/03 2014

v0.1.1

0.1.1.0

  Sources   Download

MIT

by Ivan Pushkin