Beispiel #1
0
 /**
  * Creates thumb from model->image attribute with specified width and height.
  * @param int|null $width
  * @param int|null $height
  * @param bool $crop if false image will be resize instead of cropping
  * @return string
  */
 public function thumb($width = null, $height = null, $crop = true)
 {
     if ($this->image && ($width || $height)) {
         return Image::thumbFrontend($this->image, $width, $height, $crop);
     }
     return '';
 }
Beispiel #2
0
use common\populac\modules\gallery\api\Gallery;
use common\populac\modules\page\api\Page;
use yii\helpers\Html;
use yii\helpers\Url;
$page = Page::get('page-gallery');
$this->title = $page->model->title;
$this->params['breadcrumbs'][] = $this->title;
?>
<h1><?php 
echo $this->title;
?>
</h1>
<br/>

<?php 
foreach (Gallery::cats() as $album) {
    ?>
    <a class="center-block" href="<?php 
    echo Url::to(['ji_sheng_feng_cai/view', 'slug' => $album->slug]);
    ?>
">
        <?php 
    echo Html::img(Image::thumbFrontend($album->image, 160, 120));
    ?>
<br/><?php 
    echo $album->title;
    ?>
    </a>
    <br/>
<?php 
}