$img = imagine\Image::getImagine()->open(Yii::getAlias($fullName));
$size = $img->getSize();
$ratio = $size->getWidth()/$size->getHeight();
$width = 200;
$height = round($width/$ratio);
$box = new Box($width, $height);
$img->resize($box)->save($filePath.'/thumb/' . $fileName);
// OR:
imagine\Image::thumbnail($fullName,$width,$height)
->save($filePath.'/thumb/' . $fileName);
<?= ListView::widget([
'dataProvider' => $dataProvider,
'itemOptions' => ['tag' => false],
//'itemView' => '_teaser',
'itemView' => function ($model, $key, $index, $widget) {
return $this->render('_teaser', [
'model' => $model,
'key' => $key,
'index' => $index,
'widget' => $widget,
]);
}
]) ?>
<div class="item" data-key="<?=$model->id?>">
...
</div>
<?php if (($index+1) % 3 == 0) : ?>
я после третьего?
<?php endif; ?>