コード例 #1
0
ファイル: view.php プロジェクト: ngdvan/lntguitar
function getImgThumb($item)
{
    $path = Yii::getPathOfAlias('webroot') . $item['image'];
    if (file_exists($path)) {
        $img = new Image($path);
        return $img->createThumb(105, 70);
    } else {
        return Lnt::getYoutubeImage($item['link_youtube']);
    }
}
コード例 #2
0
ファイル: index.php プロジェクト: ngdvan/lntguitar
        }
        $divClass = 'item';
        if ($u == 3) {
            $divClass .= ' citem';
        } else {
        }
        if ($i > 3) {
            $divClass .= ' mtop';
        }
        //var_dump(Lnt::getYoutubeImage($aitem['youtube']));die;
        echo CHtml::openTag("div", array("class" => $divClass));
        $imagPath = Yii::getPathOfAlias('webroot') . '/' . $aitem['image'];
        if (is_file($imagPath)) {
            echo CHtml::image(Lnt::createImage($aitem['image'], 105, 70));
        } else {
            echo CHtml::image(Lnt::getYoutubeImage($aitem['youtube']));
        }
        //echo Lnt::getYoutubeImage($aitem['youtube']);
        echo CHtml::openTag("div", array('class' => 'title'));
        echo CHtml::link(Lnt::limitWord($aitem['title'], 8), $aitem['url'], array('title' => $aitem['title']));
        echo CHtml::closeTag("div");
        echo CHtml::openTag("div", array('class' => 'author'));
        echo CHtml::link($aitem['username'], $this->createUrl('/user/view', array('username' => $aitem['username'])));
        echo CHtml::closeTag("div");
        echo CHtml::closeTag("div");
        $i++;
    }
}
?>
    </div>
    <div class="list_home clearfix" style="margin-top: 15px">
コード例 #3
0
ファイル: _view.php プロジェクト: ngdvan/lntguitar
<?php

/**
 * @var $data Video
 * @var $image Image
 */
$url = $this->createUrl('/video/view', array('id' => $data->id, 'title' => Lnt::safeTitle($data->title)));
//$imageUrl = Lnt::getYoutubeImage($data->link_youtube);
?>
<div class="item">
    <div class="img">
        <?php 
echo CHtml::link(CHtml::image(Lnt::getYoutubeImage($data->link_youtube)), $url);
?>
    </div>
    <div class="title"><?php 
echo CHtml::link(Lnt::limitWord(CHtml::encode($data->title), 5), $url);
?>
    </div>
    <div class="cview">Lượt xem: <?php 
echo $data->view;
?>
</div>
</div>
コード例 #4
0
ファイル: _view.php プロジェクト: ngdvan/lntguitar
<?php

/**
 * @var $data Video
 * @var $image Image
 */
$url = $this->createUrl('view', array('id' => $data->id, 'title' => Lnt::safeTitle($data->title)));
$imageUrl = '';
Yii::import('application.extensions.image.Image');
//var_dump(Yii::getPathOfAlias('webroot') . '/' . $image->uri);die;
$filePath = Yii::getPathOfAlias('webroot') . '/' . $data->image;
if (is_file($filePath)) {
    $imageUrl = Lnt::createImage($filePath, 105, 70);
} else {
    $imageUrl = Lnt::getYoutubeImage($data->link_youtube);
}
?>
<div class="item">
    <?php 
//if ($data->image):
?>
    <div class="img">
        <a href="<?php 
echo $url;
?>
">
            <img src="<?php 
echo $imageUrl;
?>
" width="110" height="70">
        </a>