spayn/thumbnail_generator_yii2_wrapper

There is no license information available for the latest version (0.1.1) of this package.

Wrapper for spayn/thumbnail_generator

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/spayn/thumbnail_generator_yii2_wrapper

0.1.1 2019-02-28 12:51 UTC

This package is auto-updated.

Last update: 2025-09-29 02:07:45 UTC


README

Usage:

// Configure
'thumbnail' => [
    'class' => 'spayn\ImageHelpers\Yii2\ThumbnailGeneratorWrapper',
    'save_path' => '@backend/web/thumbs',
    'url' => '/backend/thumbs',
    'thumbs' => [
        'common\models\Post' => [
            'picture_property' => 'image',
            'resolutions' => [
                'small' => '75x75',
                'medium' => '730x410'
            ]
        ],
        'common\models\User' => [
            'picture_property' => 'image',
            'resolutions' => [
                'small' => '80x80'
            ]
        ]
    ]
]

// Generate
Yii::$app->thumbnail->generate($model, $path_to_imagefile);

// Get url
Yii::$app->thumbnail->getFileUrl($model, 'medium');