dev-master
9999999-devCreate thumnails ad-hoc
BSD 3-Clause
The Requires
by Rafał Ciszewski
extension yii2 widget thumnails
Create thumnails ad-hoc
To install, either run, (*1)
composer require ipoz/yii2-thumbnail
or add to the required
section of your composer.json
file, (*2)
"ipoz/yii2-thumbnail": "*"
'components' => [ 'thumbnail' => [ 'class' => 'ipoz\yii2\thumbnail\Thumbnail', 'repositoryDir' => PATH_TO_YOUR_REPOSITORY ] ]
use ipoz\yii2\thumbnail\Image; ... public function actionThumbnail($image, $width, $height = 0, $type = '') { $imagePath = \Yii::$app->thumbnail->generateThumbnail($image, $width, $height, $type); return \Yii::$app->response->sendFile($imagePath, $image, [ 'mimeType' => Image::getMimeType($imagePath), 'inline' => true, ]); }
Create thumnails ad-hoc
BSD 3-Clause
extension yii2 widget thumnails